Skip to content

Commit

Permalink
Install pip-requirements-parser in workspace
Browse files Browse the repository at this point in the history
and not in the virtualenv.
  • Loading branch information
akaihola committed Jul 29, 2024
1 parent 8972d66 commit d555eda
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,27 @@
print(f"::error::Working directory does not exist: {WORKING_DIRECTORY}", flush=True)
sys.exit(21)

run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True) # nosec

def pip_install(*packages):
proc = run( # nosec
[str(ENV_BIN / "python"), "-m", "pip", "install", *packages],
def pip_install(*packages, *, python):

Check failure on line 26 in action/main.py

View workflow job for this annotation

GitHub Actions / flake8

SyntaxError: invalid syntax

Check failure on line 26 in action/main.py

View workflow job for this annotation

GitHub Actions / Pylint

action/main.py#L26

Parsing failed: 'invalid syntax (main, line 26)' (syntax-error, E0001)
pip_proc = run( # nosec
[str(python), "-m", "pip", "install", *packages],
check=False,
stdout=PIPE,
stderr=STDOUT,
encoding="utf-8",
)
print(proc.stdout, end="")
if proc.returncode:
print(pip_proc.stdout, end="")
if pip_proc.returncode:
print(f"::error::Failed to install {' '.join(packages)}.", flush=True)
sys.exit(proc.returncode)
sys.exit(pip_proc.returncode)


pip_install("pip-requirements-parser")
pip_install("pip-requirements-parser", python=sys.executable)

from pip_requirements_parser import parse_reqparts_from_string

run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True) # nosec

req = ["graylint[color]"]
if VERSION:
if VERSION.startswith("@"):
Expand All @@ -62,7 +64,7 @@ def pip_install(*packages):
req.append(str(linter_requirement))
linter_options.extend(["--lint", linter])

pip_install(*req)
pip_install(*req, python=ENV_BIN / "python")


base_cmd = [str(ENV_BIN / "darker")]
Expand Down

0 comments on commit d555eda

Please sign in to comment.