Drop dances around virtualenv
* Drop dances around virtualenv installtion, install it via get-pip.py * Allow to specify pip,wheel and setuptools versions as older openstack releases may not work with latest versions Change-Id: I59a905dd08e1797135d805bee83a85c300746294
This commit is contained in:
parent
4f6f16ae26
commit
639122fc11
@ -44,6 +44,15 @@ ARG SPICE_REF=spice-html5-0.1.6
|
||||
|
||||
# End Nova arguments
|
||||
|
||||
# Virtualenv arguments
|
||||
|
||||
ARG GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
|
||||
ARG PIP_CONSTRAINT=""
|
||||
ARG SETUPTOOL_CONSTRAINT=""
|
||||
ARG WHEEL_CONSTRAIN=""
|
||||
|
||||
# End virtualenv argumens
|
||||
|
||||
ADD data /tmp/
|
||||
COPY scripts /opt/loci/scripts
|
||||
ADD bindep.txt pydep.txt $EXTRA_BINDEP $EXTRA_PYDEP /opt/loci/
|
||||
|
@ -28,6 +28,7 @@ case ${distro} in
|
||||
lsb-release \
|
||||
patch \
|
||||
sudo \
|
||||
wget \
|
||||
bind9-host \
|
||||
${dpkg_python_packages[@]}
|
||||
apt-get install -y --no-install-recommends \
|
||||
|
@ -2,41 +2,22 @@
|
||||
|
||||
set -ex
|
||||
|
||||
PIP_CONSTRAINT=${PIP_CONSTRAINT}
|
||||
SETUPTOOL_CONSTRAINT=${SETUPTOOL_CONSTRAINT}
|
||||
WHEEL_CONSTRAIN=${WHEEL_CONSTRAIN}
|
||||
VIRTUALENV="python3 -m virtualenv --python=python3 --no-seed"
|
||||
|
||||
TMP_VIRTUALENV="python3 -m virtualenv --python=python3"
|
||||
|
||||
# This little dance allows us to install the latest pip
|
||||
# without get_pip.py or the python-pip package (in epel on centos)
|
||||
if (( $(${TMP_VIRTUALENV} --version | grep -Po '[0-9]+\.[0-9]+\.[0-9]+' | cut -d. -f1) >= 14 )); then
|
||||
SETUPTOOLS="--no-setuptools"
|
||||
fi
|
||||
if (( $(${TMP_VIRTUALENV} --version | grep -Po '[0-9]+\.[0-9]+\.[0-9]+' | cut -d. -f1) >= 20 )); then
|
||||
SETUPTOOLS="--seed pip --download"
|
||||
fi
|
||||
|
||||
# virtualenv 16.4.0 fixed symlink handling. The interaction of the new
|
||||
# corrected behavior with legacy bugs in packaged virtualenv releases in
|
||||
# distributions means we need to hold on to the pip bootstrap installation
|
||||
# chain to preserve symlinks. As distributions upgrade their default
|
||||
# installations we may not need this workaround in the future
|
||||
PIPBOOTSTRAP=/var/lib/pipbootstrap
|
||||
|
||||
# Create the boostrap environment so we can get pip from virtualenv
|
||||
${TMP_VIRTUALENV} ${SETUPTOOLS} ${PIPBOOTSTRAP}
|
||||
source ${PIPBOOTSTRAP}/bin/activate
|
||||
|
||||
# Install setuptools explicitly required for virtualenv > 20 installation
|
||||
pip install --upgrade setuptools
|
||||
|
||||
# Upgrade to the latest version of virtualenv
|
||||
pip install --upgrade ${PIP_ARGS} virtualenv==20.7.2
|
||||
|
||||
# Forget the cached locations of python binaries
|
||||
hash -r
|
||||
wget $GET_PIP_URL -O /tmp/get-pip.py
|
||||
|
||||
# Create the virtualenv with the updated toolchain for openstack service
|
||||
virtualenv --seed pip --download /var/lib/openstack
|
||||
# for using python-rbd which is not pip installable and is only available
|
||||
# in packaged form.
|
||||
$VIRTUALENV --system-site-packages --extra-search-dir=/tmp/wheels /var/lib/openstack
|
||||
|
||||
# Deactivate the old bootstrap virtualenv and switch to the new one
|
||||
deactivate
|
||||
source /var/lib/openstack/bin/activate
|
||||
|
||||
python /tmp/get-pip.py
|
||||
|
||||
pip install --upgrade pip${PIP_CONSTRAINT}
|
||||
pip install --upgrade setuptools${SETUPTOOL_CONSTRAINT}
|
||||
pip install --upgrade wheel${WHEEL_CONSTRAIN}
|
||||
|
Loading…
x
Reference in New Issue
Block a user