mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
fix: use specified python for venv
This commit is contained in:
parent
60569ba897
commit
df84c2772d
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user