summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2017-03-04 06:05:06 (GMT)
committerGitHub <noreply@github.com>2017-03-04 06:05:06 (GMT)
commit95c50e5aed9e5683676e18349dd94b11901a66b3 (patch)
treed0e57a3b64c496f48ba99eb12149b4393b082570 /Lib/platform.py
parent793f822068335cff68f25304a915c726f3f3a599 (diff)
downloadcpython-95c50e5aed9e5683676e18349dd94b11901a66b3.zip
cpython-95c50e5aed9e5683676e18349dd94b11901a66b3.tar.gz
cpython-95c50e5aed9e5683676e18349dd94b11901a66b3.tar.bz2
[3.6] bpo-27593: Get SCM build info from git instead of hg. (#446) (#454)
* 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. (cherry picked from commit 5c4b0d063aba0a68c325073f5f312a2c9f40d178)
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 0623475..cc2db98 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1198,7 +1198,9 @@ def _sys_version(sys_version=None):
elif buildtime:
builddate = builddate + ' ' + buildtime
- if hasattr(sys, '_mercurial'):
+ if hasattr(sys, '_git'):
+ _, branch, revision = sys._git
+ elif hasattr(sys, '_mercurial'):
_, branch, revision = sys._mercurial
elif hasattr(sys, 'subversion'):
# sys.subversion was added in Python 2.5