CI: Fix tests on Linux, Ansible tests targetting Debian 9 & 11

Without Ubuntu 20.04 virtualenv package being installed pip was installing a
version of virtualenv that couldn't create the Tox environment for Python 2.7.

> Successfully installed distlib-0.3.6 filelock-3.12.2 platformdirs-3.8.0
> pluggy-1.2.0 py-1.11.0 tomli-2.0.1 tox-3.28.0 virtualenv-20.23.1
> Finishing: Install tooling
> ...
> py27-mode_mitogen-distro_centos6 create: /home/vsts/work/1/s/.tox/py27-
> mode_mitogen-distro_centos6
> ERROR: invocation failed (exit code 1), logfile: /home/vsts/work/1/s/.tox/
> py27-mode_mitogen-distro_centos6/log/py27-mode_mitogen-distro_centos6-0.log
> ================================== log start
> ===================================
> RuntimeError: failed to query /usr/bin/python2.7 with code 1 err:
> '  File "/home/vsts/.local/lib/python3.8/site-packages/virtualenv/discovery/
> py_info.py", line 24\n    return list(OrderedDict.fromkeys(["",
> *os.environ.get("PATHEXT", "").lower().split(os.pathsep)]))\n
> ^\nSyntaxError: invalid syntax\n'
This commit is contained in:
Alex Willmer 2023-07-01 17:30:36 +01:00
parent 330375be32
commit 19b79f7ab5
5 changed files with 31 additions and 1 deletions

View File

@ -12,9 +12,14 @@ 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 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'))

View File

@ -28,6 +28,7 @@ v0.3.4.dev0
resource leaks. resource leaks.
* :gh:issue:`659` Removed :mod:`mitogen.compat.simplejson`, not needed with Python 2.7+, contained Python 3.x syntax errors * :gh:issue:`659` Removed :mod:`mitogen.compat.simplejson`, not needed with Python 2.7+, contained Python 3.x syntax errors
* :gh:issue:`983` CI: Removed PyPI faulthandler requirement from tests * :gh:issue:`983` CI: Removed PyPI faulthandler requirement from tests
* :gh:issue:`1001` CI: Fixed Debian 9 & 11 tests
v0.3.3 (2022-06-03) v0.3.3 (2022-06-03)
------------------- -------------------

View File

@ -15,6 +15,30 @@
when: when:
- ansible_facts.pkg_mgr in ["dnf"] - ansible_facts.pkg_mgr in ["dnf"]
- name: Switch to archive.debian.org
# Debian 9 has been archived https://lists.debian.org/debian-devel-announce/2023/03/msg00006.html
copy:
content: |
deb http://archive.debian.org/debian stretch main contrib non-free
dest: /etc/apt/sources.list
mode: u=rw,go=r
when:
- ansible_facts.distribution == "Debian"
- ansible_facts.distribution_major_version == "9"
- name: Add signing keys
copy:
src: "{{ item.src }}"
dest: "/etc/apt/trusted.gpg.d/{{ item.src | basename }}"
mode: u=rw,go=r
loop:
- src: debian-archive-bullseye-automatic.gpg # Debian 11
- src: debian-archive-bookworm-automatic.gpg # Debian 12
when:
# Ideally this would check for Debian 11, but distribution_major_version
# is unpopulated sometimes.
- ansible_facts.distribution == "Debian"
- name: Update package index - name: Update package index
apt: apt:
update_cache: true update_cache: true