mirror of https://github.com/astral-sh/uv
Ensure we retain existing environment variables during `python -m uv` (#1667)
From https://github.com/astral-sh/uv/issues/1623#issuecomment-1951368507 I thought I checked this was working correctly in #1504 but I guess the environment is not preserved like I thought.
This commit is contained in:
parent
3ed386c0c5
commit
b317e6fc56
|
|
@ -50,10 +50,10 @@ def find_uv_bin() -> str:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uv = os.fsdecode(find_uv_bin())
|
uv = os.fsdecode(find_uv_bin())
|
||||||
|
|
||||||
env = {}
|
env = os.environ.copy()
|
||||||
venv = detect_virtualenv()
|
venv = detect_virtualenv()
|
||||||
if venv:
|
if venv:
|
||||||
env["VIRTUAL_ENV"] = venv
|
env.setdefault("VIRTUAL_ENV", venv)
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue