Skip to content

Commit

Permalink
fix: Pass cwd for cmd subprocess execution
Browse files Browse the repository at this point in the history
Also, use python instead of python3 hardcoded in env
  • Loading branch information
gavindsouza committed Aug 1, 2022
1 parent bff9dfd commit 01b7759
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self, path):

@property
def python(self) -> str:
return get_env_cmd("python3", bench_path=self.name)
return get_env_cmd("python", bench_path=self.name)

@property
def shallow_clone(self) -> bool:
Expand Down Expand Up @@ -352,15 +352,18 @@ def env(self, python="python3"):

if not os.path.exists(self.bench.python):
if virtualenv:
self.run(f"{virtualenv} {quiet_flag} env -p {python}")
self.run(f"{virtualenv} {quiet_flag} env -p {python}", cwd=self.bench.name)
else:
venv = get_venv_path(verbose=verbose, python=python)
self.run(f"{venv} env")
self.run(f"{venv} env", cwd=self.bench.name)

self.pip()

if os.path.exists(frappe):
self.run(f"{self.bench.python} -m pip install {quiet_flag} --upgrade -e {frappe}")
self.run(
f"{self.bench.python} -m pip install {quiet_flag} --upgrade -e {frappe}",
cwd=self.bench.name,
)

@step(title="Setting Up Bench Config", success="Bench Config Set Up")
def config(self, redis=True, procfile=True):
Expand Down Expand Up @@ -388,7 +391,9 @@ def pip(self, verbose=False):
verbose = bench.cli.verbose or verbose
quiet_flag = "" if verbose else "--quiet"

return self.run(f"{self.bench.python} -m pip install {quiet_flag} --upgrade pip")
return self.run(
f"{self.bench.python} -m pip install {quiet_flag} --upgrade pip", cwd=self.bench.name
)

def logging(self):
from bench.utils import setup_logging
Expand Down

0 comments on commit 01b7759

Please sign in to comment.