summaryrefslogtreecommitdiffstats
path: root/Modules/getbuildinfo.c
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2017-03-04 05:19:55 (GMT)
committerGitHub <noreply@github.com>2017-03-04 05:19:55 (GMT)
commit5c4b0d063aba0a68c325073f5f312a2c9f40d178 (patch)
tree9dd85d1261b732477a4ed38bd5d63de2d3c2e847 /Modules/getbuildinfo.c
parentfc64c351c7757f0ebdb7da65cb74871e494a2add (diff)
downloadcpython-5c4b0d063aba0a68c325073f5f312a2c9f40d178.zip
cpython-5c4b0d063aba0a68c325073f5f312a2c9f40d178.tar.gz
cpython-5c4b0d063aba0a68c325073f5f312a2c9f40d178.tar.bz2
bpo-27593: Get SCM build info from git instead of hg. (#446)
sys.version and the platform module python_build(), python_branch(), and python_revision() functions now use git information rather than hg when building from a repo. Based on original patches by Brett Cannon and Steve Dower.
Diffstat (limited to 'Modules/getbuildinfo.c')
-rw-r--r--Modules/getbuildinfo.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index 0971a64..5f941a2 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -21,47 +21,47 @@
#endif
/* XXX Only unix build process has been tested */
-#ifndef HGVERSION
-#define HGVERSION ""
+#ifndef GITVERSION
+#define GITVERSION ""
#endif
-#ifndef HGTAG
-#define HGTAG ""
+#ifndef GITTAG
+#define GITTAG ""
#endif
-#ifndef HGBRANCH
-#define HGBRANCH ""
+#ifndef GITBRANCH
+#define GITBRANCH ""
#endif
const char *
Py_GetBuildInfo(void)
{
- static char buildinfo[50 + sizeof(HGVERSION) +
- ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?
- sizeof(HGTAG) : sizeof(HGBRANCH))];
- const char *revision = _Py_hgversion();
+ static char buildinfo[50 + sizeof(GITVERSION) +
+ ((sizeof(GITTAG) > sizeof(GITBRANCH)) ?
+ sizeof(GITTAG) : sizeof(GITBRANCH))];
+ const char *revision = _Py_gitversion();
const char *sep = *revision ? ":" : "";
- const char *hgid = _Py_hgidentifier();
- if (!(*hgid))
- hgid = "default";
+ const char *gitid = _Py_gitidentifier();
+ if (!(*gitid))
+ gitid = "default";
PyOS_snprintf(buildinfo, sizeof(buildinfo),
- "%s%s%s, %.20s, %.9s", hgid, sep, revision,
+ "%s%s%s, %.20s, %.9s", gitid, sep, revision,
DATE, TIME);
return buildinfo;
}
const char *
-_Py_hgversion(void)
+_Py_gitversion(void)
{
- return HGVERSION;
+ return GITVERSION;
}
const char *
-_Py_hgidentifier(void)
+_Py_gitidentifier(void)
{
- const char *hgtag, *hgid;
- hgtag = HGTAG;
- if ((*hgtag) && strcmp(hgtag, "tip") != 0)
- hgid = hgtag;
+ const char *gittag, *gitid;
+ gittag = GITTAG;
+ if ((*gittag) && strcmp(gittag, "undefined") != 0)
+ gitid = gittag;
else
- hgid = HGBRANCH;
- return hgid;
+ gitid = GITBRANCH;
+ return gitid;
}