1 This is a Solaris specific workaround to reduce the risk of damage to IPS
2 delivered Python packages by 'pip uninstall'
4 This patch prevents pip from uninstalling anything from the vendor-packages
5 folder (that should be done via pkg command). Pip can still see all packages
6 in the vendor-packages folder (for dependency resolving) but cannot remove
7 them. This prevents pip from uninstalling IPS related packages and thus
10 Updating package via pip will result in new being installed (into the
11 site-packages folder) and old forced to remain, which will give customer
12 version he needed but still keep version required by the Solaris. Pip will
13 further consider only the new version in site-packages (because it is earlier
14 in the path) and Solaris python components will use the vendor-packages one
15 (they are all patched such that they don't see other packages at all).
17 All to-be-deleted paths are checked whether they start with the vendor-packages
18 path. normalize_path is used mainly to correctly resolve symlinks.
20 Not for upstream contribution
22 --- pip-24.3.1/src/pip/_internal/req/req_uninstall.py.orig
23 +++ pip-24.3.1/src/pip/_internal/req/req_uninstall.py
25 remove/modify, False otherwise.
28 + # Omit the Solaris vendor-packages augmentation to site-packages
29 + # only when uninstalling. We want Solaris IPS delivered packages
30 + # in vendor-packages to be able to satisfy install dependencies
31 + # but pip should never remove them.
32 + vendor_packages_path = '/usr/lib/python{}.{}/vendor-packages'.format(
33 + sys.version_info.major, sys.version_info.minor)
34 + if normalize_path(path).startswith(vendor_packages_path):
36 # aka is_local, but caching normalized sys.prefix
37 if not running_under_virtualenv():