2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

fix(utils): Strip * from cmd via get_env_cmd

This commit is contained in:
Gavin D'souza 2022-08-02 12:18:40 +05:30
parent 78742b9546
commit 6ae1997bff

View File

@ -22,17 +22,18 @@ logger = logging.getLogger(bench.PROJECT_NAME)
@lru_cache(maxsize=None) @lru_cache(maxsize=None)
def get_env_cmd(cmd, bench_path="."): 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) # this supports envs' generated by patched virtualenv or venv (which may cause an extra 'local' folder to be created)
existing_python_bins = glob( existing_python_bins = glob(
os.path.abspath(os.path.join(bench_path, "env", "**", "bin", cmd)), recursive=True os.path.join(bench_path, "env", "**", "bin", cmd), recursive=True
) )
if existing_python_bins: if existing_python_bins:
return existing_python_bins[0] return existing_python_bins[0]
return os.path.abspath(os.path.join(bench_path, "env", "bin", cmd)) cmd = cmd.strip("*")
return os.path.join(bench_path, "env", "bin", cmd)
def get_venv_path(verbose=False, python="python3"): def get_venv_path(verbose=False, python="python3"):