Skip to content

Commit

Permalink
temp: don't use pipx
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Feb 20, 2024
1 parent 2870b3f commit b38bbce
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,48 @@ runs:
allow-prereleases: true

- name: "Install nox"
run: pipx install --python "${{ steps.allpython.outputs.python-path }}" '${{ github.action_path }}'
run: |
# Install nox
"${{ steps.allpython.outputs.python-path }}" -u << "EOF"
import os
import shutil
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.bin_path = Path(context.env_exe).parent
run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
print("::group::Install nox")
nox_bin_path = Path(r"${{ runner.temp }}") / "nox"
if nox_bin_path.exists():
shutil.rmtree(nox_bin_path)
venv_path = Path(r"${{ runner.temp }}") / "nox-venv"
if venv_path.exists():
shutil.rmtree(venv_path)
builder = EnvBuilder()
builder.create(venv_path)
nox_path = [path for path in builder.bin_path.glob("nox*") if path.stem == "nox"][0]
nox_bin_path.mkdir()
try:
os.symlink(nox_path, nox_bin_path / nox_path.name)
except OSError:
shutil.copyfile(nox_path, nox_bin_path / nox_path.name)
with open(os.environ["GITHUB_PATH"], "at") as f:
f.write(f"{nox_bin_path}\n")
print("::endgroup::")
EOF
shell: bash

0 comments on commit b38bbce

Please sign in to comment.