aboutsummaryrefslogtreecommitdiff
path: root/app/backends
diff options
context:
space:
mode:
Diffstat (limited to 'app/backends')
-rw-r--r--app/backends/envs.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/backends/envs.py b/app/backends/envs.py
index ff6d1bf..494c3e2 100644
--- a/app/backends/envs.py
+++ b/app/backends/envs.py
@@ -89,9 +89,16 @@ def env_exists(env_dir: Optional[Path] = None) -> bool:
def is_managed_env() -> bool:
- """True when the current process is already running inside the app venv."""
+ """True when the current process is already running inside the app venv.
+
+ Compares sys.prefix (the environment the current interpreter belongs to)
+ with ENV_DIR instead of the interpreter path: a venv's bin/python is
+ typically a symlink to the base interpreter, so resolving sys.executable
+ would also make the bare system python look like the managed env and
+ silently skip the bootstrap (and with it the requirements install).
+ """
try:
- return Path(sys.executable).resolve() == env_python().resolve()
+ return Path(sys.prefix).resolve() == ENV_DIR.resolve()
except OSError:
return False