summaryrefslogtreecommitdiff
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2017-03-04 00:19:55 -0500
committerGitHub <noreply@github.com>2017-03-04 00:19:55 -0500
commit5c4b0d063aba0a68c325073f5f312a2c9f40d178 (patch)
tree9dd85d1261b732477a4ed38bd5d63de2d3c2e847 /Lib/platform.py
parentfc64c351c7757f0ebdb7da65cb74871e494a2add (diff)
downloadcpython-git-5c4b0d063aba0a68c325073f5f312a2c9f40d178.tar.gz
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 '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 0623475375..cc2db9870d 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