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

fix: Fetch env python if exists before returning fallback

This commit is contained in:
Gavin D'souza 2022-08-01 11:47:04 +05:30
parent 0cd5fca322
commit e5fa4df5f9
2 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import shutil
import json import json
import sys import sys
import logging import logging
from glob import glob
from typing import List, MutableSequence, TYPE_CHECKING, Union from typing import List, MutableSequence, TYPE_CHECKING, Union
# imports - module imports # imports - module imports
@ -71,6 +72,11 @@ class Bench(Base, Validator):
@property @property
def python(self) -> str: 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) return get_env_cmd("python", bench_path=self.name)
@property @property

View File

@ -40,7 +40,7 @@ def get_venv_path(verbose=False, python="python3"):
if is_venv_installed: if is_venv_installed:
return f"{python} -m venv" return f"{python} -m venv"
else: else:
log("virtualenv cannot be found", level=2) log("venv cannot be found", level=2)
def update_node_packages(bench_path=".", apps=None): def update_node_packages(bench_path=".", apps=None):