Skip to content

Commit

Permalink
fix(utils): Strip * from cmd via get_env_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Aug 2, 2022
1 parent 78742b9 commit 6ae1997
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@


@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)

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:
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"):
Expand Down

0 comments on commit 6ae1997

Please sign in to comment.