Skip to content

Commit 91a73e2

Browse files
committed
Handle setup.py in _pip.py
1 parent c1b7593 commit 91a73e2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pyperformance/_pip.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,16 @@ def install_requirements(reqs, *extra,
149149
args = []
150150
if upgrade:
151151
args.append('-U') # --upgrade
152-
for reqs in [reqs, *extra]:
153-
if os.path.isfile(reqs) and reqs.endswith('.txt'):
154-
args.append('-r') # --requirement
155-
args.append(reqs)
152+
for req in [reqs, *extra]:
153+
if os.path.isfile(req):
154+
name = os.path.basename(req)
155+
if name == "setup.py":
156+
req = os.path.dirname(req)
157+
elif name == "requirements.txt":
158+
args.append('-r') # --requirement
159+
else:
160+
raise ValueError(f"pip doesn't know how to install {req}")
161+
args.append(req)
156162
return run_pip('install', *args, **kwargs)
157163

158164

pyperformance/venv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def from_benchmarks(cls, benchmarks):
2727
if bench.setup_py:
2828
# pip doesn't support installing a setup.py,
2929
# but it does support installing from the directory it is in.
30-
self._add(os.path.dirname(bench.setup_py))
30+
self._add(bench.setup_py)
3131
return self
3232

3333
def __init__(self):

0 commit comments

Comments
 (0)