From b6e301898c364aeee1840bb066447cec7ccb18a1 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Mon, 18 Mar 2024 07:34:11 -0400 Subject: [PATCH] Explicitly check if `python -c "import distutils"` is possible This makes the check more general and compatible with later versions of Python than just 3.12. --- .github/workflows/eb_command.yml | 4 ++-- .github/workflows/unit_tests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/eb_command.yml b/.github/workflows/eb_command.yml index ac909b5cd3..ec99594a86 100644 --- a/.github/workflows/eb_command.yml +++ b/.github/workflows/eb_command.yml @@ -32,8 +32,8 @@ jobs: # update to latest pip, check version pip install --upgrade pip pip --version - if [[ "${{matrix.python}}" == 3.12 ]]; then - # needed for python setup.py sdist + if ! python -c "import distutils" 2> /dev/null; then + # we need setuptools for distutils in Python 3.12+, needed for python setup.py sdist pip install --upgrade setuptools fi diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 60fdba402e..ce739ff46d 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -85,8 +85,8 @@ jobs: pip install --upgrade pip pip --version pip install -r requirements.txt - if [[ "${{matrix.python}}" == 3.12 ]]; then - # needed for python setup.py sdist + if ! python -c "import distutils" 2> /dev/null; then + # we need setuptools for distutils in Python 3.12+, needed for python setup.py sdist pip install --upgrade setuptools fi # git config is required to make actual git commits (cfr. tests for GitRepository)