build-wheel-cache: Don't use virtualenv on python3 platforms

As noted inline, platforms are starting to decide to deprecate
virtualenv for "python3 -m venv".  Put in logic to use venv in our
Python 3 paths.

Change-Id: I46778642647d7be995d476fb567a9943cae66b8f
This commit is contained in:
Ian Wienand 2022-02-08 16:33:40 +11:00
parent 1f9d9b40f5
commit d1fd2e556c
2 changed files with 19 additions and 1 deletions

View File

@ -8,6 +8,15 @@ LOGS=$(pwd)/logs
FAIL_LOG=${LOGS}/failed.txt
# NOTE(ianw) : Some Python 3 platforms (>= 9-stream) are deprecating
# virtualenv. When we finally ditch Python 2 platforms, just use
# python3 -m venv everywhere.
if [[ ${PYTHON_VERSION} =~ python2 ]]; then
VIRTUALENV_CMD="virtualenv -p $PYTHON_VERSION"
else
VIRTUALENV_CMD="${PYTHON_VERSION} -m venv"
fi
# preclean logs
mkdir -p ${LOGS}
rm -rf ${LOGS}/*
@ -44,7 +53,7 @@ for BRANCH in master $BRANCHES; do
# setup the building virtualenv. We want to freshen this for each
# branch.
rm -rf build_env
virtualenv -p $PYTHON_VERSION build_env
${VIRTUALENV_CMD} build_env
build_env/bin/pip install --upgrade pip

View File

@ -1,6 +1,15 @@
- name: Ensure virtualenv dependency
include_role:
name: ensure-virtualenv
when: wheel_python == "python2"
# NOTE(ianw) : 2022-02-08 - on python3 we use -m venv; ensure-pip will
# set this up for us. Remove above and the conditional here when we
# drop python2 platforms.
- name: Ensure pip
include_role:
name: ensure-pip
when: wheel_python == "python3"
- name: Ensure wheel dir exists
file: