From 46471d61e4349bba2d0c702de18f91a5b201bb66 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 27 Jan 2016 15:48:11 -0500 Subject: [PATCH] pip < 1.6 cannot parse requirement specifiers to the `install` command that contain a `+` in the version. For these older versions, directly install the wheel or install from the sdist. Technically 1.4 and later can install wheels, but in testing, only 1.5+ was able to install them properly with their scripts. The new heredoc execute and redirect syntax is Bourne-compatible. pip --pre is no longer necessary since the Galaxy pip version is no longer a development version of pip. --- scripts/common_startup.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/common_startup.sh b/scripts/common_startup.sh index 2bd90808324..c8e7f2c4bbb 100755 --- a/scripts/common_startup.sh +++ b/scripts/common_startup.sh @@ -139,8 +139,28 @@ fi : ${GALAXY_WHEELS_INDEX_URL:="https://wheels.galaxyproject.org/simple"} if [ $REPLACE_PIP -eq 1 ]; then pip_version=`pip --version | awk '{print $2}'` - pre=`python -c "from pkg_resources import parse_version; from sys import stdout; stdout.write('--pre') if parse_version('$pip_version') >= parse_version('1.4') else stdout.write('')"` - pip install $pre --no-index --find-links ${GALAXY_WHEELS_INDEX_URL}/pip --upgrade "pip==${GXPIP_VERSION}" + method=`python - << EOF +from pkg_resources import parse_version +from sys import stdout +if parse_version('$pip_version') >= parse_version('1.6'): + stdout.write('req') +elif parse_version('$pip_version') >= parse_version('1.5'): + stdout.write('wheel') +else: + stdout.write('sdist') +EOF` + case $method in + req) + pip install --no-index --find-links ${GALAXY_WHEELS_INDEX_URL}/pip --upgrade "pip==${GXPIP_VERSION}" + ;; + wheel) + pip install --upgrade "https://wheels.galaxyproject.org/packages/pip-${GXPIP_VERSION}-py2.py3-none-any.whl" + ;; + sdist) + pip install --upgrade "https://wheels.galaxyproject.org/packages/pip-${GXPIP_VERSION}.tar.gz" + ;; + esac + # binary-compatibility.cfg may need to be created (e.g. on CentOS) [ -n "$VIRTUAL_ENV" -a ! -f ${VIRTUAL_ENV}/binary-compatibility.cfg ] && python ./scripts/binary_compatibility.py -o ${VIRTUAL_ENV}/binary-compatibility.cfg fi