2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-27 22:39:03 +00:00

fix: use specified python for venv

This commit is contained in:
barredterra 2022-07-28 14:19:09 +02:00
parent 60569ba897
commit df84c2772d
2 changed files with 4 additions and 5 deletions

View File

@ -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()

View File

@ -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)