(
cmd: List[str],
workspace_root: Path,
*,
step: str | None = None,
env: Dict[str, str] | None = None,
timeout: float | None = None,
)
| 149 | |
| 150 | |
| 151 | def _run_uv_command( |
| 152 | cmd: List[str], |
| 153 | workspace_root: Path, |
| 154 | *, |
| 155 | step: str | None = None, |
| 156 | env: Dict[str, str] | None = None, |
| 157 | timeout: float | None = None, |
| 158 | ) -> Dict[str, Any]: |
| 159 | timeout_value = _DEFAULT_TIMEOUT if timeout is None else timeout |
| 160 | env_vars = None if env is None else {**os.environ, **env} |
| 161 | try: |
| 162 | completed = subprocess.run( |
| 163 | cmd, |
| 164 | cwd=str(workspace_root), |
| 165 | capture_output=True, |
| 166 | text=True, |
| 167 | timeout=timeout_value, |
| 168 | check=False, |
| 169 | env=env_vars, |
| 170 | ) |
| 171 | except FileNotFoundError as exc: |
| 172 | raise RuntimeError("uv command not found in PATH") from exc |
| 173 | except subprocess.TimeoutExpired as exc: |
| 174 | stdout_text = exc.stdout |
| 175 | if stdout_text is None: |
| 176 | stdout_text = getattr(exc, "output", "") or "" |
| 177 | stderr_text = exc.stderr or "" |
| 178 | message = _build_timeout_message(step, timeout_value, stdout_text, stderr_text) |
| 179 | return { |
| 180 | "command": cmd, |
| 181 | "stdout": stdout_text, |
| 182 | "stderr": stderr_text, |
| 183 | "returncode": None, |
| 184 | "step": step, |
| 185 | "timed_out": True, |
| 186 | "timeout": timeout_value, |
| 187 | "error": message, |
| 188 | } |
| 189 | |
| 190 | return { |
| 191 | "command": cmd, |
| 192 | "stdout": completed.stdout or "", |
| 193 | "stderr": completed.stderr or "", |
| 194 | "returncode": completed.returncode, |
| 195 | # "cwd": str(workspace_root), |
| 196 | "step": step, |
| 197 | } |
| 198 | |
| 199 | |
| 200 | def install_python_packages( |
no test coverage detected