@@ -31,15 +31,43 @@ runs:
3131 python-version : " 3.8 - 3.12"
3232 update-environment : false
3333
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 sys
40+ import venv
41+
42+ from pathlib import Path
43+ from subprocess import run
44+
45+
46+ class EnvBuilder(venv.EnvBuilder):
47+ def __init__(self):
48+ super().__init__()
49+
50+ def setup_scripts(self, context):
51+ pass
52+
53+ def post_setup(self, context):
54+ super().post_setup(context)
55+ self.python_path = context.env_exe
56+ run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
57+
58+
59+ print("::group::Install cibuildwheel")
60+ builder = EnvBuilder()
61+ builder.create(Path(r"${{ runner.temp }}") / "cibw")
62+ with open(os.environ["GITHUB_OUTPUT"], "at") as f:
63+ f.write(f"python-path={builder.python_path}\n")
64+ print("::endgroup::")
65+ EOF
3766 shell : bash
3867
3968 # Redirecting stderr to stdout to fix interleaving issue in Actions.
4069 - run : >
41- "${{ steps.python.outputs.python-path }}" -m pipx run
42- --spec '${{ github.action_path }}'
70+ "${{ steps.cibw.outputs.python-path }}" -m
4371 cibuildwheel
4472 "${{ inputs.package-dir }}"
4573 ${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
5179
5280 # Windows needs powershell to interact nicely with Meson
5381 - run : >
54- & "${{ steps.python.outputs.python-path }}" -m pipx run
55- --spec "${{ github.action_path }}"
82+ & "${{ steps.cibw.outputs.python-path }}" -m
5683 cibuildwheel
5784 "${{ inputs.package-dir }}"
5885 ${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
0 commit comments