]>
Commit | Line | Data |
---|---|---|
7eb75bcc DM |
1 | #include "Python.h"\r |
2 | \r | |
3 | #ifndef DONT_HAVE_STDIO_H\r | |
4 | #include <stdio.h>\r | |
5 | #endif\r | |
6 | \r | |
7 | #ifndef DATE\r | |
8 | #ifdef __DATE__\r | |
9 | #define DATE __DATE__\r | |
10 | #else\r | |
11 | #define DATE "xx/xx/xx"\r | |
12 | #endif\r | |
13 | #endif\r | |
14 | \r | |
15 | #ifndef TIME\r | |
16 | #ifdef __TIME__\r | |
17 | #define TIME __TIME__\r | |
18 | #else\r | |
19 | #define TIME "xx:xx:xx"\r | |
20 | #endif\r | |
21 | #endif\r | |
22 | \r | |
23 | /* on unix, SVNVERSION is passed on the command line.\r | |
24 | * on Windows, the string is interpolated using\r | |
25 | * subwcrev.exe\r | |
26 | */\r | |
27 | #ifndef SVNVERSION\r | |
28 | #define SVNVERSION "$WCRANGE$$WCMODS?M:$"\r | |
29 | #endif\r | |
30 | \r | |
31 | /* XXX Only unix build process has been tested */\r | |
32 | #ifndef HGVERSION\r | |
33 | #define HGVERSION ""\r | |
34 | #endif\r | |
35 | #ifndef HGTAG\r | |
36 | #define HGTAG ""\r | |
37 | #endif\r | |
38 | #ifndef HGBRANCH\r | |
39 | #define HGBRANCH ""\r | |
40 | #endif\r | |
41 | \r | |
42 | const char *\r | |
43 | Py_GetBuildInfo(void)\r | |
44 | {\r | |
45 | static char buildinfo[50 + sizeof(HGVERSION) +\r | |
46 | ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?\r | |
47 | sizeof(HGTAG) : sizeof(HGBRANCH))];\r | |
48 | const char *revision = _Py_hgversion();\r | |
49 | const char *sep = *revision ? ":" : "";\r | |
50 | const char *hgid = _Py_hgidentifier();\r | |
51 | if (!(*hgid))\r | |
52 | hgid = "default";\r | |
53 | PyOS_snprintf(buildinfo, sizeof(buildinfo),\r | |
54 | "%s%s%s, %.20s, %.9s", hgid, sep, revision,\r | |
55 | DATE, TIME);\r | |
56 | return buildinfo;\r | |
57 | }\r | |
58 | \r | |
59 | const char *\r | |
60 | _Py_svnversion(void)\r | |
61 | {\r | |
62 | /* the following string can be modified by subwcrev.exe */\r | |
63 | static const char svnversion[] = SVNVERSION;\r | |
64 | if (svnversion[0] != '$')\r | |
65 | return svnversion; /* it was interpolated, or passed on command line */\r | |
66 | return "Unversioned directory";\r | |
67 | }\r | |
68 | \r | |
69 | const char *\r | |
70 | _Py_hgversion(void)\r | |
71 | {\r | |
72 | return HGVERSION;\r | |
73 | }\r | |
74 | \r | |
75 | const char *\r | |
76 | _Py_hgidentifier(void)\r | |
77 | {\r | |
78 | const char *hgtag, *hgid;\r | |
79 | hgtag = HGTAG;\r | |
80 | if ((*hgtag) && strcmp(hgtag, "tip") != 0)\r | |
81 | hgid = hgtag;\r | |
82 | else\r | |
83 | hgid = HGBRANCH;\r | |
84 | return hgid;\r | |
85 | }\r |