Skip to content

Commit b3be52e

Browse files
authored
Update etstool.py for recent EDM, Python 3.11, and Apple Silicon (#1261)
This PR updates `etstool.py` for recent EDM versions, Python 3.11 support, and Apple Silicon support. Note that not all dependencies are present yet for 3.11 (we're missing `flake8-ets`, along with several dependencies on Apple Silicon), so the 3.11 aspect isn't yet usable.
1 parent 825c452 commit b3be52e

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

.github/workflows/test-with-edm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest, windows-latest]
2020
toolkit: ['pyside6']
21+
runtime: ['3.8']
2122
fail-fast: false
2223
timeout-minutes: 20 # should be plenty, it's usually < 5
2324
runs-on: ${{ matrix.os }}
@@ -44,7 +45,7 @@ jobs:
4445
- name: Install click to the default EDM environment
4546
run: edm install -y wheel click coverage
4647
- name: Install test environment
47-
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }}
48+
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}
4849
- name: Run tests (Linux)
4950
if: matrix.os == 'ubuntu-latest'
5051
run: xvfb-run -a edm run -- python etstool.py test --toolkit=${{ matrix.toolkit }}

etstool.py

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
5151
python etstool.py test-all
5252
53-
Currently supported runtime values include ``3.6``, and currently
53+
Currently supported runtime values are ``3.8`` and ``3.11``, and currently
5454
supported toolkits are ``null``, ``pyqt5``, ``pyqt6``, ``pyside2``, ``pyside6``
5555
and ``wx``. Not all combinations of toolkits and runtimes will work, but the
5656
tasks will fail with a clear error if that is the case.
@@ -74,6 +74,7 @@
7474

7575
import glob
7676
import os
77+
import platform
7778
import subprocess
7879
import sys
7980
from shutil import rmtree, copy as copyfile
@@ -82,8 +83,37 @@
8283

8384
import click
8485

86+
87+
def current_platform():
88+
"""Return the current platform as a string."""
89+
if sys.platform.startswith("win32"):
90+
return "windows"
91+
elif sys.platform.startswith("linux"):
92+
return "linux"
93+
elif sys.platform.startswith("darwin"):
94+
if "RELEASE_ARM64" in platform.uname().version:
95+
return "macos-arm"
96+
else:
97+
return "macos"
98+
else:
99+
raise click.ClickException(f"Platform {sys.platform} not supported")
100+
101+
102+
# Supported toolkits for each runtime.
85103
supported_combinations = {
86104
"3.8": {"pyside6", "pyqt6"},
105+
"3.11": {"pyside6", "pyqt6"},
106+
}
107+
108+
# EDS platform strings, keyed by runtime and platform (as returned by current_platform()).
109+
EDS_PLATFORMS = {
110+
("3.8", "linux"): "rh7-x86_64",
111+
("3.8", "windows"): "win-x86_64",
112+
("3.8", "macos"): "osx-x86_64",
113+
("3.11", "linux"): "rh8-x86_64",
114+
("3.11", "windows"): "win-x86_64",
115+
("3.11", "macos"): "osx-x86_64",
116+
("3.11", "macos-arm"): "osx-arm64",
87117
}
88118

89119
# Traits version requirement (empty string to mean no specific requirement).
@@ -102,8 +132,8 @@
102132
"packaging",
103133
}
104134

105-
# if on mac, see if we can handle pillow_simd - do we have AVX2? - see #1207
106-
if sys.platform == "darwin":
135+
# if on mac/Intel, see if we can handle pillow_simd - do we have AVX2? - see #1207
136+
if current_platform() == "macos":
107137
result = subprocess.run(
108138
['sysctl', 'machdep.cpu.leaf7_features'],
109139
capture_output=True,
@@ -206,7 +236,7 @@ def install(edm, runtime, toolkit, environment, editable, source):
206236

207237
# edm commands to setup the development environment
208238
commands = [
209-
"edm environments create {environment} --force --version={runtime}",
239+
"edm environments create {environment} --force --version={runtime} --platform={platform}",
210240
"{edm} install -y -e {environment} --add-repository enthought/lgpl --add-repository enthought/gpl " + packages, # noqa: E501
211241
"{edm} run -e {environment} -- pip install -r ci-src-requirements.txt --no-dependencies", # noqa: E501
212242
install_pyface,
@@ -485,7 +515,7 @@ def get_parameters(edm, runtime, toolkit, environment):
485515
if edm is None:
486516
edm = locate_edm()
487517
parameters["edm"] = edm
488-
518+
parameters["platform"] = EDS_PLATFORMS[runtime, current_platform()]
489519
return parameters
490520

491521

0 commit comments

Comments
 (0)