From 66955cc76a9b33716baa6bdcc575d0446cf9175e Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 14 Jun 2025 14:42:31 -0400 Subject: [PATCH 1/2] Minor CI clarifications - In the Cygwin CI workflow, move `runs-on` below `strategy`, for greater consistency with other workflows. - In the Cygwin CI jobs, use `pwsh` rather than `bash` for the `git config` command run outside of Cygwin, since `pwsh` is the default shell for such commands, it's the shell the Cygwin setup action uses, and it avoids creating the wrong impression that `bash` is needed. - Use "virtual environment" instead of "virtualenv" in some step names to avoid possible confusion with the `virtualenv` pacakge. - Remove comments in the PyPA package upgrade steps, which are more self-documenting since 727f4e9 (#2043). --- .github/workflows/alpine-test.yml | 3 +-- .github/workflows/cygwin-test.yml | 9 ++++----- .github/workflows/pythonpackage.yml | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/alpine-test.yml b/.github/workflows/alpine-test.yml index a3361798d..ceba11fb8 100644 --- a/.github/workflows/alpine-test.yml +++ b/.github/workflows/alpine-test.yml @@ -47,13 +47,12 @@ jobs: # and cause subsequent tests to fail cat test/fixtures/.gitconfig >> ~/.gitconfig - - name: Set up virtualenv + - name: Set up virtual environment run: | python -m venv .venv - name: Update PyPA packages run: | - # Get the latest pip, wheel, and prior to Python 3.12, setuptools. . .venv/bin/activate python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel diff --git a/.github/workflows/cygwin-test.yml b/.github/workflows/cygwin-test.yml index 6943db09c..28a41a362 100644 --- a/.github/workflows/cygwin-test.yml +++ b/.github/workflows/cygwin-test.yml @@ -7,8 +7,6 @@ permissions: jobs: test: - runs-on: windows-latest - strategy: matrix: selection: [fast, perf] @@ -20,6 +18,8 @@ jobs: fail-fast: false + runs-on: windows-latest + env: CHERE_INVOKING: "1" CYGWIN_NOWINPATH: "1" @@ -32,7 +32,7 @@ jobs: - name: Force LF line endings run: | git config --global core.autocrlf false # Affects the non-Cygwin git. - shell: bash # Use Git Bash instead of Cygwin Bash for this step. + shell: pwsh # Do this outside Cygwin, to affect actions/checkout. - uses: actions/checkout@v4 with: @@ -67,7 +67,7 @@ jobs: # and cause subsequent tests to fail cat test/fixtures/.gitconfig >> ~/.gitconfig - - name: Set up virtualenv + - name: Set up virtual environment run: | python3.9 -m venv --without-pip .venv echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV" @@ -78,7 +78,6 @@ jobs: - name: Update PyPA packages run: | - # Get the latest pip, wheel, and prior to Python 3.12, setuptools. python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel - name: Install project and test dependencies diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c56d45df7..f3d977760 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -71,7 +71,6 @@ jobs: - name: Update PyPA packages run: | - # Get the latest pip, wheel, and prior to Python 3.12, setuptools. python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel - name: Install project and test dependencies From 8e24edfb4688180287c970b023516c2b71946778 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 14 Jun 2025 14:57:40 -0400 Subject: [PATCH 2/2] Use *-wheel packages as a better fix for #2004 This installs the `python-pip-wheel`, `python-setuptools-wheel`, and `python-wheel-wheel` packages on Cygwini CI, which provide `.whl` files for `pip`, `setuptools`, and `wheel`. By making those wheels available, this fixes #2004 better than the previous workaround, allowing `ensurepip` to run without the error: Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error) File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details __import__(pkg_name) File "/usr/lib/python3.9/ensurepip/__init__.py", line [30](https://github.com/EliahKagan/GitPython/actions/runs/13454947366/job/37596811693#step:10:31), in _SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools") File "/usr/lib/python3.9/ensurepip/__init__.py", line 27, in _get_most_recent_wheel_version return str(max(_wheels[pkg], key=distutils.version.LooseVersion)) ValueError: max() arg is an empty sequence This change takes the place of the main changes in #2007 and #2009. In particular, it should allow `test_installation` to pass again. This also delists non-wheel Cygwin packages such as `python39-pip`, which are not needed (or at least no longer needed). (The python-{pip,setuptools,wheel}-wheel packages are, as their names suggest, intentionally not specific to Python 3.9. However, this technique will not necessarily carry over to Python 3.12, depending on what versions are supplied and other factors. This may be relevant when another attempt like #1988 is made to test/support Python 3.12 on Cygwin. At least for now, though, this seems worthwhile for fixing the Cygwin 3.9 environment, making it more similar to working local Cygwin environments and letting the workflow be more usable as guidance to how to set up a local Cygwin environment for GitPython development, and letting the installation test pass automatically.) --- .github/workflows/cygwin-test.yml | 8 ++------ test/test_installation.py | 8 -------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cygwin-test.yml b/.github/workflows/cygwin-test.yml index 28a41a362..2d0378490 100644 --- a/.github/workflows/cygwin-test.yml +++ b/.github/workflows/cygwin-test.yml @@ -41,7 +41,7 @@ jobs: - name: Install Cygwin uses: cygwin/cygwin-install-action@v5 with: - packages: python39 python39-pip python39-virtualenv git wget + packages: git python39 python-pip-wheel python-setuptools-wheel python-wheel-wheel add-to-path: false # No need to change $PATH outside the Cygwin environment. - name: Arrange for verbose output @@ -69,13 +69,9 @@ jobs: - name: Set up virtual environment run: | - python3.9 -m venv --without-pip .venv + python3.9 -m venv .venv echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV" - - name: Bootstrap pip in virtualenv - run: | - wget -qO- https://bootstrap.pypa.io/get-pip.py | python - - name: Update PyPA packages run: | python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel diff --git a/test/test_installation.py b/test/test_installation.py index a35826bd0..ae6472e98 100644 --- a/test/test_installation.py +++ b/test/test_installation.py @@ -4,19 +4,11 @@ import ast import os import subprocess -import sys - -import pytest from test.lib import TestBase, VirtualEnvironment, with_rw_directory class TestInstallation(TestBase): - @pytest.mark.xfail( - sys.platform == "cygwin" and "CI" in os.environ, - reason="Trouble with pip on Cygwin CI, see issue #2004", - raises=subprocess.CalledProcessError, - ) @with_rw_directory def test_installation(self, rw_dir): venv = self._set_up_venv(rw_dir)