diff --git a/action.yml b/action.yml index 4725f0571..e543f3418 100644 --- a/action.yml +++ b/action.yml @@ -31,25 +31,27 @@ runs: python-version: "3.8 - 3.12" update-environment: false - - id: pipx-unix + - id: pipx run: | - '${{ steps.python.outputs.python-path }}' -m venv --without-pip '${{ runner.temp }}/pipx4cibw' - '${{ steps.python.outputs.python-path }}' -m pip --python '${{ runner.temp }}/pipx4cibw/bin/python' install pipx - echo 'pipx-path=${{ runner.temp }}/pipx4cibw/bin/pipx' >> $GITHUB_OUTPUT - shell: bash - if: runner.os != 'Windows' + import os + import sys - - id: pipx-win - run: | - "${{ steps.python.outputs.python-path }}" -m venv --without-pip "${{ runner.temp }}\pipx4cibw" - "${{ steps.python.outputs.python-path }}" -m pip --python "${{ runner.temp }}\pipx4cibw\Scripts\python.exe" install pipx - echo "pipx-path=${{ runner.temp }}\pipx4cibw\Scripts\pipx.exe" >> $GITHUB_OUTPUT - shell: pwsh - if: runner.os == 'Windows' + from pathlib import Path + from subprocess import run + + bin = "Scripts" if sys.platform == "win32" else "bin" + ext = ".exe" if sys.platform == "win32" else "bin" + temp = Path(r"${{ runner.temp }}") + run([sys.executable, "-m", "venv", "--without-pip", str(temp / "pipx4cibw")], check=True) + run([sys.executable, "-m", "pip", "--python", str(temp / "pipx4cibw" / bin / f"python{ext}"), "install", "pipx"], check=True) + pipx_path = temp / "pipx4cibw" / bin / f"pipx{ext}" + with open(os.environ["GITHUB_OUTPUT"], "at") as f: + f.write(f"pipx-path={pipx_path}\n") + shell: ${{ steps.python.outputs.python-path }} {0} # Redirecting stderr to stdout to fix interleaving issue in Actions. - run: > - '${{ steps.pipx-unix.outputs.pipx-path }}' run + '${{ steps.pipx.outputs.pipx-path }}' run --python '${{ steps.python.outputs.python-path }}' --spec '${{ github.action_path }}' cibuildwheel @@ -63,7 +65,7 @@ runs: # Windows needs powershell to interact nicely with Meson - run: > - "${{ steps.pipx-win.outputs.pipx-path }}" run + "${{ steps.pipx.outputs.pipx-path }}" run --python "${{ steps.python.outputs.python-path }}" --spec "${{ github.action_path }}" cibuildwheel