Skip to content

Commit e1ce6e3

Browse files
committed
python-setup: Fix venv creation in Ubuntu 22.04
Fixes #1249
1 parent aaca819 commit e1ce6e3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

python-setup/install_tools.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#! /usr/bin/pwsh
22

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

610
# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
711
# pip/setuptools/wheel which basic `python3 -m venv venv` won't

python-setup/install_tools.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ set -e
1111
export PATH="$HOME/.local/bin:$PATH"
1212

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

1622
# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
1723
# pip/setuptools/wheel which basic `python3 -m venv venv` won't
@@ -40,7 +46,7 @@ if command -v python2 >/dev/null 2>&1; then
4046
curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
4147
fi
4248

43-
python2 -m pip install --user --upgrade pip setuptools wheel
49+
python2 -m pip install --user --upgrade pip 'setuptools<60' wheel
4450

4551
python2 -m pip install --user 'virtualenv<20.11'
4652
fi

0 commit comments

Comments
 (0)