Skip to content

Commit

Permalink
Bootstrap pip in Cygwin Python 3.12 venv in a separate step
Browse files Browse the repository at this point in the history
This works around a problem in Python 3.12 on Cygwin where `pip`
fails to intall in a venv via `ensurepip` (both implicitly when the
venv is created normally, and explicitly when `python -m ensurepip`
is attempted), by creating the venv with `--without-pip` and then,
once the venv is set up, bootstrapping `pip` in it by running the
https://bootstrap.pypa.io/get-pip.py script.

Eventually, when `pip` is working automatically in a venv in
Python 3.12 on Cygwin (the problem is specific to that combination,
and the Cygwin `python312*` packages are still marked "test"), this
special-casing can be removed.
  • Loading branch information
EliahKagan committed Jan 4, 2025
1 parent 18c7b96 commit 3dc5366
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
include:
- python-version: "3.9"
python-cygwin: python39
python-command: python3.9
venv-args: ''
- python-version: "3.12"
python-cygwin: python312
python-command: python3.12
venv-args: --without-pip

fail-fast: false

Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up Cygwin
uses: egor-tensin/setup-cygwin@v4
with:
packages: ${{ matrix.python-cygwin }} ${{ matrix.python-cygwin }}-pip ${{ matrix.python-cygwin }}-virtualenv git
packages: ${{ matrix.python-cygwin }} ${{ matrix.python-cygwin }}-pip ${{ matrix.python-cygwin }}-virtualenv git wget

- name: Arrange for verbose output
run: |
Expand All @@ -67,9 +67,14 @@ jobs:
- name: Set up virtualenv
run: |
${{ matrix.python-command }} -m venv .venv
python${{ matrix.python-version }} -m venv ${{ matrix.venv-args }} .venv
echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"
- name: Bootstrap pip in virtualenv
if: contains(matrix.venv-args, '--without-pip')
run: |
wget -qO- https://bootstrap.pypa.io/get-pip.py | python
- name: Update PyPA packages
run: |
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
Expand Down

0 comments on commit 3dc5366

Please sign in to comment.