@@ -17,6 +17,10 @@ inputs:
1717 description : ' Build a specific wheel only. No need for arch/platform if this is set'
1818 required : false
1919 default : ' '
20+ extras :
21+ description : ' Comma-separated list of extras to install'
22+ required : false
23+ default : ' '
2024branding :
2125 icon : package
2226 color : yellow
4246 from pathlib import Path
4347 from subprocess import run
4448
49+ EXTRAS = set(e.strip() for e in "${{ inputs.extras }}".split(",") if e.strip())
50+ if sys.platform == "linux":
51+ EXTRAS.discard("uv")
52+
4553
4654 class EnvBuilder(venv.EnvBuilder):
4755 def __init__(self):
5361 def post_setup(self, context):
5462 super().post_setup(context)
5563 self.bin_path = Path(context.env_exe).parent
56- run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
64+ install_spec = r"${{ github.action_path }}"
65+ if EXTRAS:
66+ install_spec += f"[{','.join(sorted(EXTRAS))}]"
67+ run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", install_spec], check=True)
5768
5869
5970 print("::group::Install cibuildwheel")
@@ -62,30 +73,47 @@ runs:
6273 shutil.rmtree(venv_path)
6374 builder = EnvBuilder()
6475 builder.create(venv_path)
65- cibw_path = [path for path in builder.bin_path.glob("cibuildwheel*") if path.stem == "cibuildwheel"][0]
76+ exposed_binaries = {"cibuildwheel"}
77+ if "uv" in EXTRAS:
78+ exposed_binaries.add("uv")
79+ clean_bin_path = builder.bin_path.parent / f"{builder.bin_path.name}.clean"
80+ clean_bin_path.mkdir()
81+ for path in list(builder.bin_path.iterdir()):
82+ if path.stem in exposed_binaries:
83+ try:
84+ os.symlink(path, clean_bin_path / path.name)
85+ except OSError:
86+ import shutil
87+
88+ shutil.copy2(path, clean_bin_path / path.name)
89+ full_path = f"{clean_bin_path}{os.pathsep}{os.environ['PATH']}"
6690 with open(os.environ["GITHUB_OUTPUT"], "at") as f:
67- f.write(f"cibw -path={cibw_path }\n")
91+ f.write(f"updated -path={full_path }\n")
6892 print("::endgroup::")
6993 EOF
7094 shell : bash
7195
7296 # Redirecting stderr to stdout to fix interleaving issue in Actions.
7397 - run : >
74- "${{ steps.cibw.outputs.cibw-path }}"
98+ cibuildwheel
7599 "${{ inputs.package-dir }}"
76100 ${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
77101 ${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
78102 ${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
79103 2>&1
104+ env:
105+ PATH: "${{ steps.cibw.outputs.updated-path }}"
80106 shell: bash
81107 if: runner.os != 'Windows'
82108
83109 # Windows needs powershell to interact nicely with Meson
84110 - run : >
85- & "${{ steps.cibw.outputs.cibw-path }}"
111+ cibuildwheel
86112 "${{ inputs.package-dir }}"
87113 ${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
88114 ${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
89115 ${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
116+ env:
117+ PATH: "${{ steps.cibw.outputs.updated-path }}"
90118 shell: pwsh
91119 if: runner.os == 'Windows'
0 commit comments