From 639122fc1163521a8a37ce3d2a2d8571218c542e Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Mon, 30 Dec 2024 15:09:31 +0000 Subject: [PATCH] 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 --- Dockerfile | 9 +++++++++ scripts/install.sh | 1 + scripts/setup_pip.sh | 47 +++++++++++++------------------------------- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index cae143f7..934766b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/scripts/install.sh b/scripts/install.sh index b969106d..1a7315f7 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -28,6 +28,7 @@ case ${distro} in lsb-release \ patch \ sudo \ + wget \ bind9-host \ ${dpkg_python_packages[@]} apt-get install -y --no-install-recommends \ diff --git a/scripts/setup_pip.sh b/scripts/setup_pip.sh index 76bb4caf..94e92b23 100755 --- a/scripts/setup_pip.sh +++ b/scripts/setup_pip.sh @@ -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}