Commit 5696bbc2 by Eric Coissac

--no commit message

parent 1b6921b3
......@@ -21,6 +21,9 @@ from obidistutils.serenity.globals import PIP_MINVERSION, \
from obidistutils.serenity.util import get_serenity_dir
import sys
import pkgutil
def is_pip_installed(minversion=PIP_MINVERSION):
try:
......@@ -59,17 +62,24 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
fp.write(base64.decodestring(ZIPFILE))
log.info(" done.")
zipmodule = zipimport.zipimporter(pip_zip)
pipmodule = zipmodule.load_module("pip")
# Add the zipfile to sys.path so that we can import it
sys.path = [pip_zip] + sys.path
assert LooseVersion(pipmodule.__version__) >= minversion, \
"Unable to find suitable version of pip get %s instead of %s" % (pipmodule.__version__,
minversion)
pipmodule = importlib.import_module('pip')
# Prepare the CERT certificat for https download
else:
pipmodule = importlib.import_module('pip')
cert_path = os.path.join(tmpdir, "cacert.pem")
with open(cert_path, "wb") as cert:
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
os.environ.setdefault("PIP_CERT", cert_path)
assert LooseVersion(pipmodule.__version__) >= minversion, \
"Unable to find suitable version of pip get %s instead of %s" % (pipmodule.__version__,
minversion)
local_pip.append(pipmodule)
return local_pip[0]
......
......@@ -17592,9 +17592,14 @@ else
target=$parent
fi
echo
echo You can now use OBITools
echo ========================
echo
if [[ "$target" == *"csh" ]]
then
echo "Welcome in OBITools"
activate="$binpath/activate.csh"
else
activate="$binpath/activate"
......@@ -17680,43 +17685,7 @@ def get_a_pip_module(minversion=PIP_MINVERSION):
tmpdir = getTmpDir()
if not local_pip:
if not is_pip_installed(minversion):
print >>sys.stderr,"No convenable pip installed"
try:
pipinstallscript = urllib2.urlopen('https://bootstrap.pypa.io/get-pip.py')
except:
raise DistutilsError,"Pip (>=%s) is not install on your system and I cannot install it" % PIP_MINVERSION
print >>sys.stderr,"Downloading temporary pip..."
script = pipinstallscript.read()
getpip_py = os.path.join(tmpdir, "get-pip.py")
with open(getpip_py, "wb") as fp:
print >>sys.stderr,"Writing temporary pip..."
fp.write(script)
print >>sys.stderr," done."
getpip = imp.load_source("getpip",getpip_py)
ZIPFILE=getpip.ZIPFILE
pip_zip = os.path.join(tmpdir, "pip.zip")
print pip_zip
with open(pip_zip, "wb") as fp:
print >>sys.stderr,"Installing temporary pip..."
fp.write(base64.decodestring(ZIPFILE))
print >>sys.stderr," done."
zipmodule = zipimport.zipimporter(pip_zip)
pipmodule = zipmodule.load_module("pip")
assert LooseVersion(pipmodule.__version__) >= minversion, \
"Unable to find suitable version of pip get %s instead of %s" % (pipmodule.__version__,
minversion)
else:
pipmodule = importlib.import_module('pip')
pipmodule = importlib.import_module('pip')
# Prepare the CERT certificat for https download
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