mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 00:21:23 +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:
|
if virtualenv:
|
||||||
self.run(f"{virtualenv} {quiet_flag} env -p {python}")
|
self.run(f"{virtualenv} {quiet_flag} env -p {python}")
|
||||||
else:
|
else:
|
||||||
venv = get_venv_path(verbose=verbose)
|
venv = get_venv_path(verbose=verbose, python=python)
|
||||||
self.run(f"{venv} env")
|
self.run(f"{venv} env")
|
||||||
|
|
||||||
self.pip()
|
self.pip()
|
||||||
|
@ -32,14 +32,13 @@ def get_virtualenv_path(verbose=False):
|
|||||||
return virtualenv_path
|
return virtualenv_path
|
||||||
|
|
||||||
|
|
||||||
def get_venv_path(verbose=False):
|
def get_venv_path(verbose=False, python="python3"):
|
||||||
current_python = sys.executable
|
|
||||||
with open(os.devnull, "wb") as devnull:
|
with open(os.devnull, "wb") as devnull:
|
||||||
is_venv_installed = not subprocess.call(
|
is_venv_installed = not subprocess.call(
|
||||||
[current_python, "-m", "venv", "--help"], stdout=devnull
|
[python, "-m", "venv", "--help"], stdout=devnull
|
||||||
)
|
)
|
||||||
if is_venv_installed:
|
if is_venv_installed:
|
||||||
return f"{current_python} -m venv"
|
return f"{python} -m venv"
|
||||||
else:
|
else:
|
||||||
log("virtualenv cannot be found", level=2)
|
log("virtualenv cannot be found", level=2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user