Hrm, the original email got truncated at a "." line. Sounds like some
broken SMTP thing somewhere...

Please unblock package python-pip

python-pip (20.3.4-3) unstable; urgency=medium

  * Modify hands-off-system-packages.patch to act correctly under PyPy3, which
    shares dist-packages with cPython, but has a different sys.prefix.

[ Reason ]
PyPy and cPython on Debian share a common dist-packages directory
(/usr/lib/python3/dist-packages). However, not everything in there is
importable in PyPy. Generally C extensions are only built against
cPython.

So, users wanting to use numpy, for example, would pip install it.
However, unless one is very careful, pip will uninstall the numpy from
dist-packages, which should be managed by apt, not pip.

Pip has a patch to avoid this, but it wasn't working correctly under
PyPy, because it assumed sys.prefix == /usr.
This upload hard-codes prefix in the patch, making pip refuse to remove
files from dist-packages, when run under cPython or PyPy.

Bug describing this: https://salsa.debian.org/debian/pypy/-/issues/2

[ Impact ]
Users can fairly easily break their python3-* packages, by using pip as
root, to install modules for pypy3.

[ Tests ]
Manually tested installing & upgrading modules with pip under cpython
and pypy3.

[ Risks ]
Change is a noop on cpython, and fixes a bug on PyPy.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

unblock python-pip/20.3.4-3
diff -Nru python-pip-20.3.4/debian/changelog python-pip-20.3.4/debian/changelog
--- python-pip-20.3.4/debian/changelog  2021-05-12 08:39:26.000000000 -0400
+++ python-pip-20.3.4/debian/changelog  2021-06-28 12:20:17.000000000 -0400
@@ -1,3 +1,10 @@
+python-pip (20.3.4-3) unstable; urgency=medium
+
+  * Modify hands-off-system-packages.patch to act correctly under PyPy3, which
+    shares dist-packages with cPython, but has a different sys.prefix.
+
+ -- Stefano Rivera <stefa...@debian.org>  Mon, 28 Jun 2021 12:20:17 -0400
+
 python-pip (20.3.4-2) unstable; urgency=medium
 
   * Add myself to uploaders.
diff -Nru 
python-pip-20.3.4/debian/patches/debian-python2.7-sysconfig-workaround.patch 
python-pip-20.3.4/debian/patches/debian-python2.7-sysconfig-workaround.patch
--- 
python-pip-20.3.4/debian/patches/debian-python2.7-sysconfig-workaround.patch    
    2021-05-12 08:39:26.000000000 -0400
+++ 
python-pip-20.3.4/debian/patches/debian-python2.7-sysconfig-workaround.patch    
    2021-06-28 12:20:17.000000000 -0400
@@ -37,10 +37,10 @@
      # Use getusersitepackages if this is present, as it ensures that the
      # value is initialised properly.
 diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
-index 706937d..ebe5f29 100644
+index 459312f..b8795cc 100644
 --- a/src/pip/_internal/utils/misc.py
 +++ b/src/pip/_internal/utils/misc.py
-@@ -429,11 +429,7 @@ def dist_is_editable(dist):
+@@ -430,11 +430,7 @@ def dist_is_editable(dist):
      """
      Return True if given Distribution is an editable install.
      """
diff -Nru python-pip-20.3.4/debian/patches/hands-off-system-packages.patch 
python-pip-20.3.4/debian/patches/hands-off-system-packages.patch
--- python-pip-20.3.4/debian/patches/hands-off-system-packages.patch    
2021-05-12 08:39:26.000000000 -0400
+++ python-pip-20.3.4/debian/patches/hands-off-system-packages.patch    
2021-06-28 12:20:17.000000000 -0400
@@ -15,14 +15,14 @@
 
 Patch-Name: hands-off-system-packages.patch
 ---
- src/pip/_internal/utils/misc.py | 36 +++++++++++++++++++++++++++---------
- 1 file changed, 27 insertions(+), 9 deletions(-)
+ src/pip/_internal/utils/misc.py | 37 ++++++++++++++++++++++++++++---------
+ 1 file changed, 28 insertions(+), 9 deletions(-)
 
 diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
-index 4fb64d2..706937d 100644
+index 4fb64d2..459312f 100644
 --- a/src/pip/_internal/utils/misc.py
 +++ b/src/pip/_internal/utils/misc.py
-@@ -365,25 +365,43 @@ def renames(old, new):
+@@ -365,25 +365,44 @@ def renames(old, new):
  def is_local(path):
      # type: (str) -> bool
      """
@@ -48,7 +48,8 @@
 -    return path.startswith(normalize_path(sys.prefix))
 +
 +    path = normalize_path(path)
-+    prefix = normalize_path(sys.prefix)
++    # Hard-coded becouse PyPy uses a different sys.prefix on Debian
++    prefix = '/usr'
 +
 +    if running_under_virtualenv():
 +        return path.startswith(normalize_path(sys.prefix))

Reply via email to