From c567f6fc2e2e15e5d0c1d854a1dc65651257265b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 23 Dec 2023 05:46:54 -0500 Subject: [PATCH 1/2] Add missing pip in $PATH on Cygwin CI This makes a pip -> pip3 symlink in /usr/bin in a new step prior to the first step that runs the pip command. Using "pip3", "pip3.9", or a command like "python -m pip" would work, but this allows the Cygwin workflow to continue using the same installation commands as the main testing workflow. Adding this fixes two problems: 1. When the pip version installed by the python39-pip Cygwin package is current, so that upgrading pip doesn't install any new commmand, no "pip" command is created in /usr/local. This has happened not to be the case for a long time, which is why the Cygwin workflow was able to pass. (That the recent failures started at the merge of #1783 turns out to be a coincidence: rerunning jobs on prior commits has the failure, as does experimentally reverting it.) 2. Even when the pip version installed by python39-pip is behind the latest available version, pip is still used before being upgraded to check if setuptools is installed, to decide whether to upgrade it. This is to keep similar steps in the two testing workflows similar, since the Cygwin workflow only uses Python 3.9, which always has setuptools. Because pip was never in $PATH in that step, the Cygwin workflow wrongly refrained from trying to upgrade setuptools. When the "Update PyPA packages" step does find a newer version of pip to upgrade to, it installs it in /usr/local/bin, which we have in $PATH before /usr/bin, so the upgraded version, when present, will still be preferred in subsequent commands, as before. Running "pip" on Cygwin when it may not be in $PATH -- and, for one step, never is -- was a bug introduced in e8956e5 (#1709). Before that, "pip" still was not always available, but it was not used. This change fixes the bug by making sure "pip" is always available. --- .github/workflows/cygwin-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cygwin-test.yml b/.github/workflows/cygwin-test.yml index 13a01dec4..13804031b 100644 --- a/.github/workflows/cygwin-test.yml +++ b/.github/workflows/cygwin-test.yml @@ -55,6 +55,11 @@ jobs: # and cause subsequent tests to fail cat test/fixtures/.gitconfig >> ~/.gitconfig + - name: Ensure the "pip" command is available + run: | + # This is used unless, and before, an updated pip is installed. + ln -s pip3 /usr/bin/pip + - name: Update PyPA packages run: | # Get the latest pip, wheel, and prior to Python 3.12, setuptools. From 7ef7245456ad3953b5d1760281984f17c2a0640f Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 23 Dec 2023 06:17:09 -0500 Subject: [PATCH 2/2] Make setuptools check on CI more precise This checks for setuptools as a full word at the very beginning of a line of output from "pip freeze --all", to: - Avoid the unlikely but possible case that setuptools is absent while something besides setuptools has "setuptools" in its line. - Prevent "setuptools" from being passed to install multiple times. This causes no problems -- it's still only installed/upgraded at most once -- but it was making the GitHub Actions log confusing on Cygwin. (It could happen on other platforms, but hasn't been.) --- .github/workflows/cygwin-test.yml | 2 +- .github/workflows/pythonpackage.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cygwin-test.yml b/.github/workflows/cygwin-test.yml index 13804031b..f3937d21e 100644 --- a/.github/workflows/cygwin-test.yml +++ b/.github/workflows/cygwin-test.yml @@ -63,7 +63,7 @@ jobs: - name: Update PyPA packages run: | # Get the latest pip, wheel, and prior to Python 3.12, setuptools. - python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel + python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel - name: Install project and test dependencies run: | diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e9a7486be..08ff4efdf 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -56,7 +56,7 @@ jobs: - name: Update PyPA packages run: | # Get the latest pip, wheel, and prior to Python 3.12, setuptools. - python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel + python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel - name: Install project and test dependencies run: |