Line data Source code
1 : #include "Python.h"
2 :
3 : #ifndef DONT_HAVE_STDIO_H
4 : #include <stdio.h>
5 : #endif
6 :
7 : #ifndef DATE
8 : #ifdef __DATE__
9 : #define DATE __DATE__
10 : #else
11 : #define DATE "xx/xx/xx"
12 : #endif
13 : #endif
14 :
15 : #ifndef TIME
16 : #ifdef __TIME__
17 : #define TIME __TIME__
18 : #else
19 : #define TIME "xx:xx:xx"
20 : #endif
21 : #endif
22 :
23 : /* XXX Only unix build process has been tested */
24 : #ifndef HGVERSION
25 : #define HGVERSION ""
26 : #endif
27 : #ifndef HGTAG
28 : #define HGTAG ""
29 : #endif
30 : #ifndef HGBRANCH
31 : #define HGBRANCH ""
32 : #endif
33 :
34 : const char *
35 1 : Py_GetBuildInfo(void)
36 : {
37 : static char buildinfo[50 + sizeof(HGVERSION) +
38 : ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?
39 : sizeof(HGTAG) : sizeof(HGBRANCH))];
40 1 : const char *revision = _Py_hgversion();
41 1 : const char *sep = *revision ? ":" : "";
42 1 : const char *hgid = _Py_hgidentifier();
43 1 : if (!(*hgid))
44 1 : hgid = "default";
45 1 : PyOS_snprintf(buildinfo, sizeof(buildinfo),
46 : "%s%s%s, %.20s, %.9s", hgid, sep, revision,
47 : DATE, TIME);
48 1 : return buildinfo;
49 : }
50 :
51 : const char *
52 2 : _Py_hgversion(void)
53 : {
54 2 : return HGVERSION;
55 : }
56 :
57 : const char *
58 2 : _Py_hgidentifier(void)
59 : {
60 : const char *hgtag, *hgid;
61 2 : hgtag = HGTAG;
62 2 : if ((*hgtag) && strcmp(hgtag, "tip") != 0)
63 0 : hgid = hgtag;
64 : else
65 2 : hgid = HGBRANCH;
66 2 : return hgid;
67 : }
|