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.
This commit is contained in:
Nate Coraor
2016-01-28 10:45:54 -05:00
parent 390c1fc275
commit 46471d61e4
+22 -2
View File
@@ -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