@@ -31,16 +31,48 @@ runs:
31
31
python-version : " 3.8 - 3.12"
32
32
update-environment : false
33
33
34
- # macos-14 (M1) may be missing pipx (due to it not having CPython)
35
- - run : |
36
- "${{ steps.python.outputs.python-path }}" -m pip install pipx
34
+ - id : cibw
35
+ run : |
36
+ # Install cibuildwheel
37
+ "${{ steps.python.outputs.python-path }}" -u << "EOF"
38
+ import os
39
+ import shutil
40
+ import sys
41
+ import venv
42
+
43
+ from pathlib import Path
44
+ from subprocess import run
45
+
46
+
47
+ class EnvBuilder(venv.EnvBuilder):
48
+ def __init__(self):
49
+ super().__init__()
50
+
51
+ def setup_scripts(self, context):
52
+ pass
53
+
54
+ def post_setup(self, context):
55
+ super().post_setup(context)
56
+ self.bin_path = Path(context.env_exe).parent
57
+ run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
58
+
59
+
60
+ print("::group::Install cibuildwheel")
61
+ venv_path = Path(r"${{ runner.temp }}") / "cibw"
62
+ if venv_path.exists():
63
+ shutil.rmtree(venv_path)
64
+ builder = EnvBuilder()
65
+ builder.create(venv_path)
66
+ cibw_path = [path for path in builder.bin_path.glob("cibuildwheel*") if path.stem == "cibuildwheel"][0]
67
+ with open(os.environ["GITHUB_OUTPUT"], "at") as f:
68
+ f.write(f"cibw-path={cibw_path}\n")
69
+ print("::endgroup::")
70
+ EOF
37
71
shell : bash
38
72
39
73
# Redirecting stderr to stdout to fix interleaving issue in Actions.
40
74
- run : >
41
- "${{ steps.python.outputs.python-path }}" -m pipx run
42
- --spec '${{ github.action_path }}'
43
- cibuildwheel
75
+ "${{ steps.cibw.outputs.cibw-path }}"
44
76
"${{ inputs.package-dir }}"
45
77
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
46
78
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
51
83
52
84
# Windows needs powershell to interact nicely with Meson
53
85
- run : >
54
- & "${{ steps.python.outputs.python-path }}" -m pipx run
55
- --spec "${{ github.action_path }}"
56
- cibuildwheel
86
+ & "${{ steps.cibw.outputs.cibw-path }}"
57
87
"${{ inputs.package-dir }}"
58
88
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
59
89
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
0 commit comments