ci: Fix Python 2.7 builds on macOS 11

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
(#1033), so tests that call a local context with `python` fail.
pull/1032/head
Alex Willmer 1 year ago
parent b7188c1cad
commit f9a6748154

@ -13,21 +13,33 @@ steps:
versionSpec: '$(python.version)' versionSpec: '$(python.version)'
condition: ne(variables['python.version'], '') condition: ne(variables['python.version'], '')
- script: |
type python
python --version
displayName: Show python version
- script: | - script: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y python2-dev python3-pip virtualenv sudo apt-get install -y python2-dev python3-pip virtualenv
displayName: Install build deps displayName: Install build deps
condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux')) 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 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" displayName: "Run tests"
env: env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)

Loading…
Cancel
Save