Files
nixpkgs/pkgs/servers/home-assistant/patches/pythonpath-is-a-venv.patch
Martin Weinelt 656aacd913 home-assistant: hide install method deprecation
We would not get this warning if we were running in a virtualenv. But we
are composing a PYTHONPATH which is similar enough to a virtualenv that
I don't fear runniing out of support.
2026-05-07 02:59:18 +02:00

18 lines
638 B
Diff

diff --git a/homeassistant/util/package.py b/homeassistant/util/package.py
index 21149f43cb2..faf3cdbd31d 100644
--- a/homeassistant/util/package.py
+++ b/homeassistant/util/package.py
@@ -32,8 +32,10 @@ class InstalledPackage(TypedDict):
def is_virtual_env() -> bool:
"""Return if we run in a virtual environment."""
# Check supports venv && virtualenv
- return getattr(sys, "base_prefix", sys.prefix) != sys.prefix or hasattr(
- sys, "real_prefix"
+ return (
+ getattr(sys, "base_prefix", sys.prefix) != sys.prefix
+ or hasattr(sys, "real_prefix")
+ or "PYTHONPATH" in os.environ
)