diff --git a/.taskid b/.taskid index 3d638f2..5e9ca08 100644 --- a/.taskid +++ b/.taskid @@ -1 +1 @@ -DEVX-17 +DEVX-18 diff --git a/src/devx/tools/setup.py b/src/devx/tools/setup.py index fe11708..7243df4 100644 --- a/src/devx/tools/setup.py +++ b/src/devx/tools/setup.py @@ -29,10 +29,11 @@ def _install_python_deps(bin_dir: str, extras: str = "dev") -> None: """Install the project with the specified extras in editable mode.""" pip = str(Path(bin_dir) / "pip") cmd = [pip, "install", "-e", f".[{extras}]"] - # In CI (system Python), --break-system-packages allows upgrading - # debian-installed packages (e.g. platformdirs) that lack RECORD files. + # In CI (system Python), --break-system-packages allows installing to + # system site-packages, and --ignore-installed avoids uninstall failures + # for debian-installed packages (e.g. platformdirs) that lack RECORD files. if os.environ.get("PIP_BREAK_SYSTEM_PACKAGES") == "1": - cmd.append("--break-system-packages") + cmd.extend(["--break-system-packages", "--ignore-installed"]) _run(cmd) diff --git a/tests/unit/test_setup.py b/tests/unit/test_setup.py index 3f3ada6..024bdf5 100644 --- a/tests/unit/test_setup.py +++ b/tests/unit/test_setup.py @@ -52,7 +52,9 @@ class TestInstallPythonDeps: def test_install_with_break_system_packages(self, mock_run: MagicMock) -> None: with patch.dict(os.environ, {"PIP_BREAK_SYSTEM_PACKAGES": "1"}): _install_python_deps(".venv/bin", "ci") - mock_run.assert_called_once_with([".venv/bin/pip", "install", "-e", ".[ci]", "--break-system-packages"]) + mock_run.assert_called_once_with( + [".venv/bin/pip", "install", "-e", ".[ci]", "--break-system-packages", "--ignore-installed"] + ) class TestInstallPreCommitHooks: