Skip to content

Commit

Permalink
chore(action): do not use pipx
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Feb 17, 2024
1 parent 1dea9e4 commit b23bc58
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,43 @@ runs:
python-version: "3.8 - 3.12"
update-environment: false

# macos-14 (M1) may be missing pipx (due to it not having CPython)
- run: |
"${{ steps.python.outputs.python-path }}" -m pip install pipx
- id: cibw
run: |
# Install cibuildwheel
"${{ steps.python.outputs.python-path }}" -u << "EOF"
import os
import sys
import venv
from pathlib import Path
from subprocess import run
class EnvBuilder(venv.EnvBuilder):
def __init__(self):
super().__init__()
def setup_scripts(self, context):
pass
def post_setup(self, context):
super().post_setup(context)
self.python_path = context.env_exe
run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
print("::group::Install cibuildwheel")
builder = EnvBuilder()
builder.create(Path(r"${{ runner.temp }}") / "cibw")
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
f.write(f"python-path={builder.python_path}\n")
print("::endgroup::")
EOF
shell: bash

# Redirecting stderr to stdout to fix interleaving issue in Actions.
- run: >
"${{ steps.python.outputs.python-path }}" -m pipx run
--spec '${{ github.action_path }}'
"${{ steps.cibw.outputs.python-path }}" -m
cibuildwheel
"${{ inputs.package-dir }}"
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
Expand All @@ -51,8 +79,7 @@ runs:
# Windows needs powershell to interact nicely with Meson
- run: >
& "${{ steps.python.outputs.python-path }}" -m pipx run
--spec "${{ github.action_path }}"
& "${{ steps.cibw.outputs.python-path }}" -m
cibuildwheel
"${{ inputs.package-dir }}"
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
Expand Down

0 comments on commit b23bc58

Please sign in to comment.