Bug 1643026 - Squash stray reference to deleted global variable in virtualenv.py r=nalexander
authorRicky Stewart <rstewart@mozilla.com>
Wed, 03 Jun 2020 17:23:30 +0000
changeset 533748 a4626e14ed0db20b1df27999b173c9d40e34d450
parent 533747 c474b7ffe3af28e1f3ca7c7f3589647cdfa29a32
child 533749 192078460e82c82c8ae3a825697197200bcfd07c
push id37477
push userdluca@mozilla.com
push dateThu, 04 Jun 2020 04:19:27 +0000
treeherdermozilla-central@6fd265574f27 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1643026
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1643026 - Squash stray reference to deleted global variable in virtualenv.py r=nalexander Differential Revision: https://phabricator.services.mozilla.com/D78069
python/mozbuild/mozbuild/virtualenv.py
--- a/python/mozbuild/mozbuild/virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -680,23 +680,26 @@ class VirtualenvManager(object):
         self.activate()
 
 
 def verify_python_version(log_handle):
     """Ensure the current version of Python is sufficient."""
     from distutils.version import LooseVersion
 
     major, minor, micro = sys.version_info[:3]
-    minimum_python_version = (
-        LooseVersion('3.5.0') if major == 3 else LooseVersion('2.7.3'))
+    minimum_python_versions = {
+        2: LooseVersion('2.7.3'),
+        3: LooseVersion('3.5.0'),
+    }
     our = LooseVersion('%d.%d.%d' % (major, minor, micro))
 
-    if major not in (2, 3) or our < minimum_python_version:
-        log_handle.write('One of the following Python versions are required to build:\n')
-        for minver in MINIMUM_PYTHON_VERSIONS.values():
+    if (major not in minimum_python_versions or
+        our < minimum_python_versions[major]):
+        log_handle.write('One of the following Python versions are required:\n')
+        for minver in minimum_python_versions.values():
             log_handle.write('* Python %s or greater\n' % minver)
         log_handle.write('You are running Python %s.\n' % our)
 
         if os.name in ('nt', 'ce'):
             log_handle.write(UPGRADE_WINDOWS)
         else:
             log_handle.write(UPGRADE_OTHER)