Skip to content

Commit 0e22899

Browse files
committed
only install uv if needed
1 parent da2b288 commit 0e22899

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

repogauge/runner/container_exec.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ def _local_repo_setup_commands(test_spec) -> tuple[str, ...]:
272272
continue
273273
if command == f"chmod -R 777 {DOCKER_WORKDIR}":
274274
command = f"chmod -R a+rwX {DOCKER_WORKDIR}"
275+
if command == "pip install uv":
276+
command = "command -v uv >/dev/null || pip install uv"
275277
commands.append(command)
276278
if not commands:
277279
return ()
@@ -618,7 +620,7 @@ def _adapter_setup_commands(adapter_spec: Mapping[str, object]) -> tuple[str, ..
618620

619621
install_text = "\n".join([*pre_install, *install, *build])
620622
if "uv" in install_text and "pip install uv" not in pre_install:
621-
pre_install = ["pip install uv", *pre_install]
623+
pre_install = ["command -v uv >/dev/null || pip install uv", *pre_install]
622624

623625
commands: list[str] = [
624626
f"git config --global --add safe.directory {shlex.quote(DOCKER_WORKDIR)} || true",

tests/unit/test_container_exec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_local_repo_setup_commands_strip_remote_clone_bootstrap() -> None:
8888
"git config --global --add safe.directory /testbed || true",
8989
"chmod -R a+rwX /testbed",
9090
"cd /testbed",
91-
"pip install uv",
91+
"command -v uv >/dev/null || pip install uv",
9292
"uv sync --active --all-groups",
9393
)
9494

@@ -104,7 +104,7 @@ def test_adapter_setup_commands_install_uv_when_needed() -> None:
104104
"git config --global --add safe.directory /testbed || true",
105105
"chmod -R 777 /testbed || true",
106106
"cd /testbed",
107-
"pip install uv",
107+
"command -v uv >/dev/null || pip install uv",
108108
"uv sync --active --all-groups",
109109
"python -m pip install pytest",
110110
)

0 commit comments

Comments
 (0)