Skip to content

Commit

Permalink
Handle setup.py in _pip.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Aug 3, 2022
1 parent c1b7593 commit 91a73e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions pyperformance/_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,16 @@ def install_requirements(reqs, *extra,
args = []
if upgrade:
args.append('-U') # --upgrade
for reqs in [reqs, *extra]:
if os.path.isfile(reqs) and reqs.endswith('.txt'):
args.append('-r') # --requirement
args.append(reqs)
for req in [reqs, *extra]:
if os.path.isfile(req):
name = os.path.basename(req)
if name == "setup.py":
req = os.path.dirname(req)
elif name == "requirements.txt":
args.append('-r') # --requirement
else:
raise ValueError(f"pip doesn't know how to install {req}")
args.append(req)
return run_pip('install', *args, **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion pyperformance/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def from_benchmarks(cls, benchmarks):
if bench.setup_py:
# pip doesn't support installing a setup.py,
# but it does support installing from the directory it is in.
self._add(os.path.dirname(bench.setup_py))
self._add(bench.setup_py)
return self

def __init__(self):
Expand Down

0 comments on commit 91a73e2

Please sign in to comment.