Bug 1234954 - Use LooseVersion for parsing Mercurial version; r=me

StrictVersion is strict about version strings, insisting on whatever
convention Python uses. LooseVersion is not as strict but is strict
enough for our use cases.

DONTBUILD (NPOTB)

--HG--
extra : commitid : 17lNEAJhaV0
extra : rebase_source : 0a0cefa47b4558401cb85c6e9b237c0d6cf0e7fb
extra : amend_source : c7360d1a2f934338ec04d5f384d4530e3e9ebbc5
This commit is contained in:
Gregory Szorc 2015-12-31 16:14:20 -08:00
Родитель 109e665626
Коммит 1ee2112c8f
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -10,7 +10,6 @@ import subprocess
import sys import sys
from distutils.version import LooseVersion from distutils.version import LooseVersion
from distutils.version import StrictVersion
NO_MERCURIAL = ''' NO_MERCURIAL = '''
@ -76,7 +75,7 @@ We recommend the following tools for installing Python:
# Upgrade Mercurial older than this. # Upgrade Mercurial older than this.
# This should match OLDEST_NON_LEGACY_VERSION from # This should match OLDEST_NON_LEGACY_VERSION from
# tools/mercurial/hgsetup/wizard.py. # tools/mercurial/hgsetup/wizard.py.
MODERN_MERCURIAL_VERSION = StrictVersion('3.5.2') MODERN_MERCURIAL_VERSION = LooseVersion('3.5.2')
# Upgrade Python older than this. # Upgrade Python older than this.
MODERN_PYTHON_VERSION = LooseVersion('2.7.3') MODERN_PYTHON_VERSION = LooseVersion('2.7.3')
@ -294,7 +293,7 @@ class BaseBootstrapper(object):
print('ERROR: Unable to identify Mercurial version.') print('ERROR: Unable to identify Mercurial version.')
return True, False, None return True, False, None
our = StrictVersion(match.group(1)) our = LooseVersion(match.group(1))
return True, our >= MODERN_MERCURIAL_VERSION, our return True, our >= MODERN_MERCURIAL_VERSION, our