diff --git a/pyperformance/_pip.py b/pyperformance/_pip.py index 7eb10e04..59283a3b 100644 --- a/pyperformance/_pip.py +++ b/pyperformance/_pip.py @@ -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) diff --git a/pyperformance/venv.py b/pyperformance/venv.py index 074da3c0..93ae97b2 100644 --- a/pyperformance/venv.py +++ b/pyperformance/venv.py @@ -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):