summaryrefslogtreecommitdiffstats
path: root/Modules/getbuildinfo.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-03-05 19:51:24 (GMT)
committerGeorg Brandl <georg@python.org>2011-03-05 19:51:24 (GMT)
commit1ca2e7965c52525684bb517401c513158a8af989 (patch)
treebb4d18504b81ba63fc7b46ebf05d839b51338dd7 /Modules/getbuildinfo.c
parent7b50c2c6aed2754f205835420d7450f2e401ebfd (diff)
downloadcpython-1ca2e7965c52525684bb517401c513158a8af989.zip
cpython-1ca2e7965c52525684bb517401c513158a8af989.tar.gz
cpython-1ca2e7965c52525684bb517401c513158a8af989.tar.bz2
Commit the hg build identification patch from the pymigr repo.
Diffstat (limited to 'Modules/getbuildinfo.c')
-rw-r--r--Modules/getbuildinfo.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index 3bac1c5..c70126d 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -28,15 +28,28 @@
#define SVNVERSION "$WCRANGE$$WCMODS?M:$"
#endif
+/* XXX Only unix build process has been tested */
+#ifndef HGVERSION
+#define HGVERSION ""
+#endif
+#ifndef HGTAG
+#define HGTAG ""
+#endif
+#ifndef HGBRANCH
+#define HGBRANCH ""
+#endif
+
const char *
Py_GetBuildInfo(void)
{
static char buildinfo[50];
- const char *revision = Py_SubversionRevision();
+ const char *revision = _Py_hgversion();
const char *sep = *revision ? ":" : "";
- const char *branch = Py_SubversionShortBranch();
+ const char *hgid = _Py_hgidentifier();
+ if (!(*hgid))
+ hgid = "default";
PyOS_snprintf(buildinfo, sizeof(buildinfo),
- "%s%s%s, %.20s, %.9s", branch, sep, revision,
+ "%s%s%s, %.20s, %.9s", hgid, sep, revision,
DATE, TIME);
return buildinfo;
}
@@ -50,3 +63,21 @@ _Py_svnversion(void)
return svnversion; /* it was interpolated, or passed on command line */
return "Unversioned directory";
}
+
+const char *
+_Py_hgversion(void)
+{
+ return HGVERSION;
+}
+
+const char *
+_Py_hgidentifier(void)
+{
+ const char *hgtag, *hgid;
+ hgtag = HGTAG;
+ if ((*hgtag) && strcmp(hgtag, "tip") != 0)
+ hgid = hgtag;
+ else
+ hgid = HGBRANCH;
+ return hgid;
+}