--- /dev/null
+#include "Python.h"\r
+\r
+#ifndef DONT_HAVE_STDIO_H\r
+#include <stdio.h>\r
+#endif\r
+\r
+#ifndef DATE\r
+#ifdef __DATE__\r
+#define DATE __DATE__\r
+#else\r
+#define DATE "xx/xx/xx"\r
+#endif\r
+#endif\r
+\r
+#ifndef TIME\r
+#ifdef __TIME__\r
+#define TIME __TIME__\r
+#else\r
+#define TIME "xx:xx:xx"\r
+#endif\r
+#endif\r
+\r
+/* on unix, SVNVERSION is passed on the command line.\r
+ * on Windows, the string is interpolated using\r
+ * subwcrev.exe\r
+ */\r
+#ifndef SVNVERSION\r
+#define SVNVERSION "$WCRANGE$$WCMODS?M:$"\r
+#endif\r
+\r
+/* XXX Only unix build process has been tested */\r
+#ifndef HGVERSION\r
+#define HGVERSION ""\r
+#endif\r
+#ifndef HGTAG\r
+#define HGTAG ""\r
+#endif\r
+#ifndef HGBRANCH\r
+#define HGBRANCH ""\r
+#endif\r
+\r
+const char *\r
+Py_GetBuildInfo(void)\r
+{\r
+ static char buildinfo[50 + sizeof(HGVERSION) +\r
+ ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?\r
+ sizeof(HGTAG) : sizeof(HGBRANCH))];\r
+ const char *revision = _Py_hgversion();\r
+ const char *sep = *revision ? ":" : "";\r
+ const char *hgid = _Py_hgidentifier();\r
+ if (!(*hgid))\r
+ hgid = "default";\r
+ PyOS_snprintf(buildinfo, sizeof(buildinfo),\r
+ "%s%s%s, %.20s, %.9s", hgid, sep, revision,\r
+ DATE, TIME);\r
+ return buildinfo;\r
+}\r
+\r
+const char *\r
+_Py_svnversion(void)\r
+{\r
+ /* the following string can be modified by subwcrev.exe */\r
+ static const char svnversion[] = SVNVERSION;\r
+ if (svnversion[0] != '$')\r
+ return svnversion; /* it was interpolated, or passed on command line */\r
+ return "Unversioned directory";\r
+}\r
+\r
+const char *\r
+_Py_hgversion(void)\r
+{\r
+ return HGVERSION;\r
+}\r
+\r
+const char *\r
+_Py_hgidentifier(void)\r
+{\r
+ const char *hgtag, *hgid;\r
+ hgtag = HGTAG;\r
+ if ((*hgtag) && strcmp(hgtag, "tip") != 0)\r
+ hgid = hgtag;\r
+ else\r
+ hgid = HGBRANCH;\r
+ return hgid;\r
+}\r