Commit 330ca67d by Eric Coissac

Switch Looseversion checks to StrictVersion

parent e4a1ce87
......@@ -8,7 +8,7 @@ import re
import sys
import os
from distutils.version import LooseVersion # @UnusedImport
from distutils.version import StrictVersion # @UnusedImport
from distutils.errors import DistutilsError
from distutils import log
......@@ -27,7 +27,7 @@ def is_installed(requirement,pip=None):
if len(package)==1:
if requirement_version is not None and requirement_relation is not None:
rep = (len(package)==1) and eval("LooseVersion('%s') %s LooseVersion('%s')" % (package[0].version,
rep = (len(package)==1) and eval("StrictVersion('%s') %s StrictVersion('%s')" % (package[0].version,
requirement_relation,
requirement_version)
)
......
......@@ -11,7 +11,7 @@ import base64
import zipimport
import importlib
from distutils.version import LooseVersion
from distutils.version import StrictVersion
from distutils.errors import DistutilsError
from distutils import log
......@@ -30,7 +30,7 @@ def is_pip_installed(minversion=PIP_MINVERSION):
log.info("Try to load pip module...")
pipmodule = importlib.import_module('pip')
if hasattr(pipmodule,'__version__'):
ok = LooseVersion(pipmodule.__version__) >= LooseVersion(minversion)
ok = StrictVersion(pipmodule.__version__) >= StrictVersion(minversion)
log.info("Pip installed version %s" % pipmodule.__version__)
else:
ok = False
......@@ -101,7 +101,7 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
os.environ.setdefault("PIP_CERT", cert_path)
assert hasattr(pip,'__version__') and LooseVersion(pip.__version__) >= LooseVersion(minversion), \
assert hasattr(pip,'__version__') and StrictVersion(pip.__version__) >= StrictVersion(minversion), \
"Unable to find suitable version of pip"
return local_pip[0]
......
......@@ -9,7 +9,7 @@ import sys
import os
import glob
from distutils.version import LooseVersion
from distutils.version import StrictVersion
from distutils import sysconfig
from obidistutils.serenity.checksystem import is_mac_system, \
......@@ -28,7 +28,7 @@ def is_python27(path=None):
@rtype: bool
'''
if path is None:
pythonversion = LooseVersion(sysconfig.get_python_version())
pythonversion = StrictVersion(sysconfig.get_python_version())
else:
command = """'%s' -c 'from distutils import sysconfig; """ \
"""print sysconfig.get_python_version()'""" % path
......@@ -36,10 +36,10 @@ def is_python27(path=None):
p = subprocess.Popen(command,
shell=True,
stdout=subprocess.PIPE)
pythonversion = LooseVersion(p.communicate()[0])
pythonversion = StrictVersion(p.communicate()[0])
return pythonversion >=LooseVersion("2.7") \
and pythonversion < LooseVersion("2.8")
return pythonversion >=StrictVersion("2.7") \
and pythonversion < StrictVersion("2.8")
......
......@@ -10,7 +10,7 @@ import os
import sys
from distutils.errors import DistutilsError
from distutils.version import LooseVersion
from distutils.version import StrictVersion
from distutils import log
from obidistutils.serenity.globals import PIP_MINVERSION, \
......@@ -60,7 +60,7 @@ def get_a_virtualenv_module(pip=None):
vitualenvmodule = imp.load_module('virtualenv', f, filename, description)
if minversion is not None:
assert LooseVersion(vitualenvmodule.__version__) >= minversion, \
assert StrictVersion(vitualenvmodule.__version__) >= minversion, \
"Unable to find suitable version of pip get %s instead of %s" % (vitualenvmodule.__version__,
minversion)
......
......@@ -37290,7 +37290,7 @@ import pkgutil
import stat
from distutils.errors import DistutilsError
from distutils.version import LooseVersion
from distutils.version import StrictVersion
tmpdir = []
......@@ -37333,7 +37333,7 @@ def is_pip_installed(minversion=PIP_MINVERSION):
try:
import pip # @UnresolvedImport
print pip.__file__
ok = LooseVersion(pip.__version__) >= LooseVersion(minversion)
ok = StrictVersion(pip.__version__) >= StrictVersion(minversion)
except:
ok = False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment