Skip to content

Commit

Permalink
fix: use specified python for venv
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Jul 28, 2022
1 parent 60569ba commit df84c27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def env(self, python="python3"):
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()
Expand Down
7 changes: 3 additions & 4 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit df84c27

Please sign in to comment.