From e5fa4df5f9f37046dbada7215072822a39b6ea3b Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 1 Aug 2022 11:47:04 +0530 Subject: [PATCH] fix: Fetch env python if exists before returning fallback --- bench/bench.py | 6 ++++++ bench/utils/bench.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bench/bench.py b/bench/bench.py index d94c9f70..11ed67d4 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -6,6 +6,7 @@ import shutil import json import sys import logging +from glob import glob from typing import List, MutableSequence, TYPE_CHECKING, Union # imports - module imports @@ -71,6 +72,11 @@ class Bench(Base, Validator): @property def python(self) -> str: + existing_python_bins = glob(f"{self.name}/env/bin/python*") + + if existing_python_bins: + return existing_python_bins[0] + return get_env_cmd("python", bench_path=self.name) @property diff --git a/bench/utils/bench.py b/bench/utils/bench.py index c0263657..999915ad 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -40,7 +40,7 @@ def get_venv_path(verbose=False, python="python3"): if is_venv_installed: return f"{python} -m venv" else: - log("virtualenv cannot be found", level=2) + log("venv cannot be found", level=2) def update_node_packages(bench_path=".", apps=None):