h
This commit is contained in:
@@ -791,7 +791,19 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
# and the user did not explicitly pass --venv. This matches the user's likely
|
||||
# intent when they called: <venv_python> scripts/run_client.py ...
|
||||
cur_py = Path(sys.executable)
|
||||
if args.venv is None and _is_running_in_virtualenv() and cur_py:
|
||||
|
||||
# However, if we've already found a repo-local venv and the current Python
|
||||
# is external to the repository, we do NOT prefer it yet - we'll verify the
|
||||
# repo-local one first. This prevents tools like Medios-Macina from
|
||||
# accidentally installing their own venv into the repo's services.
|
||||
cur_is_external = True
|
||||
try:
|
||||
if repo_root in cur_py.resolve().parents:
|
||||
cur_is_external = False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if args.venv is None and _is_running_in_virtualenv() and cur_py and (not venv_py or not cur_is_external):
|
||||
# If current interpreter looks like a venv and can import required modules,
|
||||
# prefer it immediately rather than forcing the repo venv.
|
||||
req = find_requirements(repo_root)
|
||||
|
||||
Reference in New Issue
Block a user