Skip to content

Commit 72ed102

Browse files
authored
PYTHON-5210 Prevent overriding the python used by other tools (#2203)
1 parent e6e8650 commit 72ed102

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.evergreen/scripts/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def run_command(cmd: str | list[str], **kwargs: Any) -> None:
137137
cmd = " ".join(cmd)
138138
LOGGER.info("Running command '%s'...", cmd)
139139
kwargs.setdefault("check", True)
140+
# Prevent overriding the python used by other tools.
141+
env = kwargs.pop("env", os.environ).copy()
142+
if "UV_PYTHON" in env:
143+
del env["UV_PYTHON"]
144+
kwargs["env"] = env
140145
try:
141146
subprocess.run(shlex.split(cmd), **kwargs) # noqa: PLW1510, S603
142147
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)