MINGW-packages/mingw-w64-python-pip/0002-only-warn-for-externally-managed.patch
Christoph Reiter 4447a7ba79 pip: in case of EXTERNALLY-MANAGED only warn instead of erroring out
We want users to move away from breaking their systems with pip, and upstream
provides PEP 668 for this where pip will error out if the system packages
are marked as externally managed (by pacman in this case).

In MSYS2 though it's not that easy to use venvs (mixing with system site packages
is sometimes requried), though things have improved with setuptools/meson-python/rust
tooling in the last year. Also in many cases MSYS2 is mainly used in CI, so it's fine
to break things as it's just a temporary VM.

To get the message still out there we downgrade the error to warning.

In the future we can escalate this further by making it an error in non-CI envs,
and adding a sleep in CI, so it gets annoying but doesn't break things rigth away.
2024-11-02 11:46:15 +01:00

14 lines
564 B
Diff

--- pip-24.1.2/src/pip/_internal/utils/misc.py.orig 2024-07-07 20:36:57.000000000 +0200
+++ pip-24.1.2/src/pip/_internal/utils/misc.py 2024-11-02 11:26:52.752980600 +0100
@@ -612,7 +612,9 @@
marker = os.path.join(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED")
if not os.path.isfile(marker):
return
- raise ExternallyManagedEnvironment.from_config(marker)
+ exc = ExternallyManagedEnvironment.from_config(marker)
+ exc.kind = "warning"
+ logger.warning("%s", exc, extra={"rich": True})
def is_console_interactive() -> bool: