termux-packages/packages/python-pip/install_py_preventing_pip_f...

24 lines
1.1 KiB
Diff

--- pip-23.0/src/pip/_internal/commands/install.py 2023-01-30 18:13:08.000000000 +0300
+++ pip-23.0/src/pip/_internal/commands/install.py.patch 2023-02-12 14:05:28.694888041 +0300
@@ -361,6 +361,20 @@
options, reqs, LegacySetupPyOptionsCheckMode.INSTALL
)
+ reqs_list = [req.name for req in reqs]
+ while reqs_list.count("pip") != 0:
+ reqs_index = reqs_list.index("pip")
+ if len(reqs)-reqs_list.count("pip") == 0:
+ raise CommandError(
+ "Installing pip is forbidden, this will break the python-pip package (termux)."
+ )
+ elif reqs_list.count("pip") == 1:
+ logger.warning(
+ "Skip installing pip, this will break the python-pip package (termux)."
+ )
+ del reqs_list[reqs_index]
+ del reqs[reqs_index]
+
if "no-binary-enable-wheel-cache" in options.features_enabled:
# TODO: remove format_control from WheelCache when the deprecation cycle
# is over