diff options
author | Georg Brandl <georg@python.org> | 2011-03-05 20:09:22 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-03-05 20:09:22 (GMT) |
commit | 8256242b30005b8a1b52e79149558ad36f1307d6 (patch) | |
tree | e02321f555790ceb1340b40da891b94556234064 | |
parent | 1ca2e7965c52525684bb517401c513158a8af989 (diff) | |
download | cpython-8256242b30005b8a1b52e79149558ad36f1307d6.zip cpython-8256242b30005b8a1b52e79149558ad36f1307d6.tar.gz cpython-8256242b30005b8a1b52e79149558ad36f1307d6.tar.bz2 |
Adapt platform and test_platform to the build identification changes.
-rwxr-xr-x | Lib/platform.py | 4 | ||||
-rw-r--r-- | Lib/test/test_platform.py | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index 7fba143..780301d 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1373,7 +1373,9 @@ def _sys_version(sys_version=None): name = 'CPython' builddate = builddate + ' ' + buildtime - if hasattr(sys, 'subversion'): + if hasattr(sys, '_mercurial'): + _, branch, revision = sys._mercurial + elif hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 _, branch, revision = sys.subversion else: diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 4fd286a..2f688a4 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -51,11 +51,13 @@ class PlatformTest(unittest.TestCase): def setUp(self): self.save_version = sys.version self.save_subversion = sys.subversion + self.save_mercurial = sys._mercurial self.save_platform = sys.platform def tearDown(self): sys.version = self.save_version sys.subversion = self.save_subversion + sys._mercurial = self.save_mercurial sys.platform = self.save_platform def test_sys_version(self): @@ -103,10 +105,12 @@ class PlatformTest(unittest.TestCase): sys_versions.items(): sys.version = version_tag if subversion is None: + if hasattr(sys, "_mercurial"): + del sys._mercurial if hasattr(sys, "subversion"): del sys.subversion else: - sys.subversion = subversion + sys._mercurial = subversion if sys_platform is not None: sys.platform = sys_platform self.assertEqual(platform.python_implementation(), info[0]) |