Skip to content

Commit

Permalink
ci: Fix Python 2.7 builds on macOS 11
Browse files Browse the repository at this point in the history
With current macOS 11 runner images (20231216.1) the `python` on `$PATH` is
Python 3.12 and setuptools isn't installed by default. E.g.

```
python -mtox -e "py27-mode_localhost-ansible4"
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc
/Users/runner/work/_temp/93a29c4c-f606-45e4-8dbd-a4a5f51b8730.sh
GLOB sdist-make: /Users/runner/work/1/s/setup.py
ERROR: invocation failed (exit code 1), logfile:
/Users/runner/work/1/s/.tox/log/GLOB-0.log
================================== log start
===================================
Traceback (most recent call last):
  File "/Users/runner/work/1/s/setup.py", line 32, in <module>
    from setuptools import find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
```

Installing setuptools under Python 3.12 chooses package versions incompatible
with Python 2.7. Additionally Mitogen isn't yet compatible with Python 3.12
(mitogen-hq#1033), so tests that call a local context with `python` fail.
  • Loading branch information
moreati committed Jan 10, 2024
1 parent b7188c1 commit f9a6748
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions .ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,33 @@ steps:
versionSpec: '$(python.version)'
condition: ne(variables['python.version'], '')

- script: |
type python
python --version
displayName: Show python version

- script: |
sudo apt-get update
sudo apt-get install -y python2-dev python3-pip virtualenv
displayName: Install build deps
condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux'))

- script: python -mpip install "tox<4.0"
- script: |
type python && python --version
type python2 && python2 --version
type python3 && python3 --version
displayName: Show python versions

- script: |
if [[ $(uname) == "Darwin" ]]; then
python2 -m ensurepip --user --altinstall --no-default-pip
python2 -m pip install --user "tox<4.0"
else
python -m pip install "tox<4.0"
fi
displayName: Install tooling

- script: python -mtox -e "$(tox.env)"
- script: |
if [[ $(uname) == "Darwin" ]]; then
python2 -m tox -e "$(tox.env)"
else
python -m tox -e "$(tox.env)"
fi
displayName: "Run tests"
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
Expand Down

0 comments on commit f9a6748

Please sign in to comment.