Use python3 venv module instead of virtualenv

We install virtualenv module using apt package
python3-virtualenv. The Ubuntu Jammy version of
this package is not compatible with the Openstack 2025.1
(requirements/upper-constrains.txt:platformdirs===4.3.6).

Venv module is part of the standard Python3 distribution
since 3.3 and we don't need it to be compatible with Python2.
Let's use it instead of virtualenv.

Change-Id: Ic70af615ef42d69a4055998130487a5ed10d2232
This commit is contained in:
Vladimir Kozhukalov 2025-04-02 17:01:03 -05:00
parent 965f5e50b2
commit 9f49737381
3 changed files with 2 additions and 8 deletions

View File

@ -46,7 +46,6 @@ ARG SPICE_REF=spice-html5-0.1.6
# Virtualenv arguments
ARG GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
ARG PIP_CONSTRAINT=""
ARG SETUPTOOL_CONSTRAINT=""
ARG WHEEL_CONSTRAIN=""

View File

@ -10,7 +10,7 @@ if [[ ${distro} == "ubuntu" ]]; then
fi
export distro_version=${DISTRO_VERSION:=$distro_version}
dpkg_python_packages=("python3" "python3-virtualenv")
dpkg_python_packages=("python3" "python3-venv")
rpm_python_packages=("python3")
case ${distro} in

View File

@ -5,19 +5,14 @@ set -ex
PIP_CONSTRAINT=${PIP_CONSTRAINT}
SETUPTOOL_CONSTRAINT=${SETUPTOOL_CONSTRAINT}
WHEEL_CONSTRAIN=${WHEEL_CONSTRAIN}
VIRTUALENV="python3 -m virtualenv --python=python3 --no-seed"
wget $GET_PIP_URL -O /tmp/get-pip.py
# Create the virtualenv with the updated toolchain for openstack service
# 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
python3 -m venv --system-site-packages /var/lib/openstack
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}