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

python-setup: rely on new virtualenv for venv creation in Ubuntu 22.04 #1402

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions python-setup/install_tools.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#! /usr/bin/pwsh

# while waiting for the next release of `virtualenv` after v20.16.5, we install an older
# version of `setuptools` to ensure that binaries are always put under
# `<venv-path>/bin`, which wouldn't always happen with the GitHub actions version of
# Ubuntu 22.04. See https://github.com/github/codeql-action/issues/1249
py -2 -m pip install --user --upgrade pip 'setuptools<60' wheel
py -3 -m pip install --user --upgrade pip 'setuptools<60' wheel
py -2 -m pip install --user --upgrade pip setuptools wheel
henrymercer marked this conversation as resolved.
Show resolved Hide resolved
py -3 -m pip install --user --upgrade pip setuptools wheel

# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
# pip/setuptools/wheel which basic `python3 -m venv venv` won't
Expand Down
19 changes: 9 additions & 10 deletions python-setup/install_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ export PATH="$HOME/.local/bin:$PATH"

# Setup Python 3 dependency installation tools.

# we install an older version of `setuptools` to ensure that binaries are always put
# under `<venv-path>/bin`, which wouldn't always happen with the GitHub actions version
# of Ubuntu 22.04. See https://github.com/github/codeql-action/issues/1249. The the next
# release of `virtualenv` after v20.16.5 will include a fix for this, so we can remove
# this bit of the logic again.
python3 -m pip install --user --upgrade pip 'setuptools<60' wheel
python3 -m pip install --user --upgrade pip setuptools wheel

# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
# pip/setuptools/wheel which basic `python3 -m venv venv` won't
python3 -m pip install --user virtualenv
# virtualenv is a bit nicer for setting up virtual environment, since it will provide
# up-to-date versions of pip/setuptools/wheel which basic `python3 -m venv venv` won't.
#
# version 20.16.5 (Python 3 only) had some problems when used together with newer
# versions of setuptools (60+) and would not always put binaries under `<venv-path>/bin`
# -- see https://github.com/github/codeql-action/issues/1249 for more details.
python3 -m pip install --user --upgrade 'virtualenv>20.16.5'
henrymercer marked this conversation as resolved.
Show resolved Hide resolved

# We install poetry with pip instead of the recommended way, since the recommended way
# caused some problem since `poetry run` gives output like:
Expand All @@ -45,7 +44,7 @@ if command -v python2 >/dev/null 2>&1; then
curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
fi

python2 -m pip install --user --upgrade pip 'setuptools<60' wheel
python2 -m pip install --user --upgrade pip setuptools wheel

python2 -m pip install --user 'virtualenv!=20.12.0'
henrymercer marked this conversation as resolved.
Show resolved Hide resolved
fi