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