Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: fix VENV variable utilization #1991

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ if [ -z $PYTHON_BIN -o ! -e $PYTHON_BIN -o ! -x $PYTHON_BIN ]; then
fi
PYTHON_VER_OUT=$($PYTHON_BIN --version)

VENV=${VENV:-"virtualenv"}
VENV=${VENV:-"./virtualenv"}
# If the venv was set to use system site-packages, fix that
if [ -f "$VENV/pyvenv.cfg" ]; then
sed -i'' -e 's/\(include-system-site-packages\s*=\s*\)true/\1false/g' $VENV/pyvenv.cfg
Expand All @@ -214,38 +214,38 @@ export LANG=${LANG:-C.UTF-8}
(echo $LANG | grep -qi utf-8) || export LC_ALL=$LANG.UTF-8

if [ -z "$NO_CLOBBER" ] && \
[ ! -e "./$VENV/bin/pip" -o ! -e "./$VENV/bin/$PYTHON" ] || \
[ "${PYTHON_VER_OUT}" != "$(./$VENV/bin/$PYTHON --version)" ] \
[ ! -e "$VENV/bin/pip" -o ! -e "$VENV/bin/$PYTHON" ] || \
[ "${PYTHON_VER_OUT}" != "$($VENV/bin/$PYTHON --version)" ] \
; then
rm -rf virtualenv
fi

if [ -z "$NO_CLOBBER" ] || [ ! -e ./$VENV ]; then
if [ -z "$NO_CLOBBER" ] || [ ! -e $VENV ]; then
$PYTHON_BIN -m venv $VENV
fi

./$VENV/bin/pip install packaging
$VENV/bin/pip install packaging

# It is impossible to upgrade ansible from 2.9 to 2.10 via pip.
# See https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.10.html#known-issues
if [ -f "$VENV/bin/ansible" ]; then
uninstall_ansible=$(./$VENV/bin/python3 -c "import ansible; from packaging.version import parse; print(parse(ansible.__version__) < parse('2.10.0'))")
uninstall_ansible=$($VENV/bin/python3 -c "import ansible; from packaging.version import parse; print(parse(ansible.__version__) < parse('2.10.0'))")
if [ "$uninstall_ansible" = "True" ]; then
./$VENV/bin/pip uninstall -y ansible
$VENV/bin/pip uninstall -y ansible
fi
fi

# First, upgrade pip
./$VENV/bin/pip install --upgrade pip
$VENV/bin/pip install --upgrade pip

# See https://github.com/pypa/pip/issues/8559
./$VENV/bin/pip install -r requirements.txt --use-pep517
$VENV/bin/pip install -r requirements.txt --use-pep517

# By default, install teuthology in editable mode
./$VENV/bin/pip install ${PIP_INSTALL_FLAGS:---editable '.[test]'}
$VENV/bin/pip install ${PIP_INSTALL_FLAGS:---editable '.[test]'}

# Check to make sure requirements are met
./$VENV/bin/pip check
$VENV/bin/pip check

# Install ansible collections
./$VENV/bin/ansible-galaxy install -r requirements.yml
$VENV/bin/ansible-galaxy install -r requirements.yml