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
(#1033), so tests that call a local context with `python` fail.
  • Loading branch information
moreati committed Jan 9, 2024
1 parent b7188c1 commit 0603f66
Show file tree
Hide file tree
Showing 2 changed files with 24 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
5 changes: 5 additions & 0 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,28 @@ jobs:
strategy:
matrix:
Mito_27:
python.version: '3.11'
tox.env: py27-mode_mitogen
Mito_311:
python.version: '3.11'
tox.env: py311-mode_mitogen

# TODO: test python3, python3 tests are broken
Loc_27_210:
python.version: '3.11'
tox.env: py27-mode_localhost-ansible2.10
Loc_27_4:
python.version: '3.11'
tox.env: py27-mode_localhost-ansible4

# NOTE: this hangs when ran in Ubuntu 18.04
Van_27_210:
python.version: '3.11'
tox.env: py27-mode_localhost-ansible2.10
STRATEGY: linear
ANSIBLE_SKIP_TAGS: resource_intensive
Van_27_4:
python.version: '3.11'
tox.env: py27-mode_localhost-ansible4
STRATEGY: linear
ANSIBLE_SKIP_TAGS: resource_intensive
Expand Down

0 comments on commit 0603f66

Please sign in to comment.