Commit 2dc7c55b by Eric Coissac

--no commit message

parent bc0378b3
......@@ -36,12 +36,16 @@ def is_pip_installed(minversion=PIP_MINVERSION):
ok = False
log.info("A too old version of pip is installed on your system")
for m in [x for x in sys.modules if x.startswith('pip.' or x=='pip')]:
# We clean up the imported pip module for test purpose
for m in [x for x in sys.modules if x.startswith('pip.')]:
del sys.modules[m]
del sys.modules['pip']
except Exception,e:
ok = False
log.info("No pip installed on your system")
log.info("No pip installed on your system")
return ok
......@@ -57,8 +61,7 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
if 'http_proxy' in os.environ and 'https_proxy' not in os.environ:
os.environ['https_proxy']=os.environ['http_proxy']
pipinstallscript = urllib2.urlopen('https://bootstrap.pypa.io/get-pip.py')
except Exception,e:
print(str(e))
except:
raise DistutilsError,"Pip (>=%s) is not install on your system and I cannot install it" % PIP_MINVERSION
script = pipinstallscript.read()
......@@ -72,7 +75,6 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
ZIPFILE=getpip.ZIPFILE
pip_zip = os.path.join(tmpdir, "pip.zip")
print pip_zip
with open(pip_zip, "wb") as fp:
log.info("Installing temporary pip...")
fp.write(base64.decodestring(ZIPFILE))
......@@ -84,11 +86,10 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
pip = zi.load_module("pip")
else:
import pip
pip = importlib.import_module('pip')
local_pip.append(pip)
print pip.__file__
# Prepare the CERT certificat for https download
cert_path = os.path.join(tmpdir, "cacert.pem")
......@@ -100,9 +101,8 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
os.environ.setdefault("PIP_CERT", cert_path)
assert hasattr(pip,'__version__') and LooseVersion(pip.__version__) >= minversion, \
"Unable to find suitable version of pip get %s instead of %s" % (pipmodule.__version__,
minversion)
assert hasattr(pip,'__version__') and LooseVersion(pip.__version__) >= LooseVersion(minversion), \
"Unable to find suitable version of pip"
return local_pip[0]
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