fix: include VIRTUAL_ENV variable (#1842)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -343,6 +343,7 @@ def build_in_container(
|
|||||||
|
|
||||||
virtualenv_env = env.copy()
|
virtualenv_env = env.copy()
|
||||||
virtualenv_env["PATH"] = f"{venv_dir / 'bin'}:{virtualenv_env['PATH']}"
|
virtualenv_env["PATH"] = f"{venv_dir / 'bin'}:{virtualenv_env['PATH']}"
|
||||||
|
virtualenv_env["VIRTUAL_ENV"] = str(venv_dir)
|
||||||
|
|
||||||
# TODO remove me once virtualenv provides pip>=24.1b1
|
# TODO remove me once virtualenv provides pip>=24.1b1
|
||||||
if config.version == "3.13":
|
if config.version == "3.13":
|
||||||
|
|||||||
@@ -576,6 +576,7 @@ def build(options: Options, tmp_path: Path) -> None:
|
|||||||
virtualenv_env["PATH"],
|
virtualenv_env["PATH"],
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
virtualenv_env["VIRTUAL_ENV"] = str(venv_dir)
|
||||||
|
|
||||||
# check that we are using the Python from the virtual environment
|
# check that we are using the Python from the virtual environment
|
||||||
call_with_arch("which", "python", env=virtualenv_env)
|
call_with_arch("which", "python", env=virtualenv_env)
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ def build(options: Options, tmp_path: Path) -> None:
|
|||||||
virtualenv_env["PATH"],
|
virtualenv_env["PATH"],
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
virtualenv_env["VIRTUAL_ENV"] = str(venv_dir)
|
||||||
|
|
||||||
# check that we are using the Python from the virtual environment
|
# check that we are using the Python from the virtual environment
|
||||||
call("which", "python", env=virtualenv_env)
|
call("which", "python", env=virtualenv_env)
|
||||||
|
|||||||
@@ -700,6 +700,7 @@ def virtualenv(
|
|||||||
paths = [str(venv_path), str(venv_path / "Scripts")] if IS_WIN else [str(venv_path / "bin")]
|
paths = [str(venv_path), str(venv_path / "Scripts")] if IS_WIN else [str(venv_path / "bin")]
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["PATH"] = os.pathsep.join([*paths, env["PATH"]])
|
env["PATH"] = os.pathsep.join([*paths, env["PATH"]])
|
||||||
|
env["VIRTUAL_ENV"] = str(venv_path)
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -501,6 +501,7 @@ def build(options: Options, tmp_path: Path) -> None:
|
|||||||
virtualenv_env["PATH"],
|
virtualenv_env["PATH"],
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
virtualenv_env["VIRTUAL_ENV"] = str(venv_dir)
|
||||||
|
|
||||||
# check that we are using the Python from the virtual environment
|
# check that we are using the Python from the virtual environment
|
||||||
call("where", "python", env=virtualenv_env)
|
call("where", "python", env=virtualenv_env)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class TestSpam(TestCase):
|
|||||||
|
|
||||||
self.assertTrue(path_contains(sys.prefix, sys.executable))
|
self.assertTrue(path_contains(sys.prefix, sys.executable))
|
||||||
self.assertTrue(path_contains(sys.prefix, spam.__file__))
|
self.assertTrue(path_contains(sys.prefix, spam.__file__))
|
||||||
|
self.assertIn("VIRTUAL_ENV", os.environ)
|
||||||
|
|
||||||
def test_uname(self):
|
def test_uname(self):
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
|||||||
Reference in New Issue
Block a user