Skip to content

Commit

Permalink
Merge pull request #1542 from ankush/fast_cli
Browse files Browse the repository at this point in the history
perf: faster cli
  • Loading branch information
ankush authored Feb 24, 2024
2 parents 7c64aa3 + 014358d commit b12ac64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions bench/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ def cli():
bench_command()

if in_bench:
if cmd_from_sys in get_frappe_commands():
frappe_cmd()
else:
app_cmd()
frappe_cmd()

bench_command()

Expand Down
10 changes: 7 additions & 3 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@

@lru_cache(maxsize=None)
def get_env_cmd(cmd: str, bench_path: str = ".") -> str:
# this supports envs' generated by patched virtualenv or venv (which may cause an extra 'local' folder to be created)
exact_location = os.path.abspath(
os.path.join(bench_path, "env", "bin", cmd.strip("*"))
)
if os.path.exists(exact_location):
return exact_location

# this supports envs' generated by patched virtualenv or venv (which may cause an extra 'local' folder to be created)
existing_python_bins = glob(
os.path.join(bench_path, "env", "**", "bin", cmd), recursive=True
)

if existing_python_bins:
return os.path.abspath(existing_python_bins[0])

cmd = cmd.strip("*")
return os.path.abspath(os.path.join(bench_path, "env", "bin", cmd))
return exact_location


def get_venv_path(verbose=False, python="python3"):
Expand Down

0 comments on commit b12ac64

Please sign in to comment.