From df84c2772d8eb7334f37ec7380bed3ac424b0cc4 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 28 Jul 2022 14:19:09 +0200 Subject: [PATCH] fix: use specified python for venv --- bench/bench.py | 2 +- bench/utils/bench.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bench/bench.py b/bench/bench.py index 1f79f190..d94c9f70 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -354,7 +354,7 @@ class BenchSetup(Base): if virtualenv: self.run(f"{virtualenv} {quiet_flag} env -p {python}") else: - venv = get_venv_path(verbose=verbose) + venv = get_venv_path(verbose=verbose, python=python) self.run(f"{venv} env") self.pip() diff --git a/bench/utils/bench.py b/bench/utils/bench.py index f0157fa8..c0263657 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -32,14 +32,13 @@ def get_virtualenv_path(verbose=False): return virtualenv_path -def get_venv_path(verbose=False): - current_python = sys.executable +def get_venv_path(verbose=False, python="python3"): with open(os.devnull, "wb") as devnull: is_venv_installed = not subprocess.call( - [current_python, "-m", "venv", "--help"], stdout=devnull + [python, "-m", "venv", "--help"], stdout=devnull ) if is_venv_installed: - return f"{current_python} -m venv" + return f"{python} -m venv" else: log("virtualenv cannot be found", level=2)