[Python-modules-commits] r31916 - in packages/python-pip/trunk/debian (5 files)

barry at users.alioth.debian.org barry at users.alioth.debian.org
Wed Feb 25 21:14:49 UTC 2015


    Date: Wednesday, February 25, 2015 @ 21:14:48
  Author: barry
Revision: 31916

* Team upload.
* Use the .whl files for de-vendorized dependencies both inside and
  outside the virtual environments.  (Closes: #744145)
* d/control: Bump Standards-Version with no other changes necessary.
* d/patches/use-venv-wheels.patch: Renamed to use-wheels.patch

Added:
  packages/python-pip/trunk/debian/patches/use-wheels.patch
Modified:
  packages/python-pip/trunk/debian/changelog
  packages/python-pip/trunk/debian/control
  packages/python-pip/trunk/debian/patches/series
Deleted:
  packages/python-pip/trunk/debian/patches/use-venv-wheels.patch

Modified: packages/python-pip/trunk/debian/changelog
===================================================================
--- packages/python-pip/trunk/debian/changelog	2015-02-25 18:46:44 UTC (rev 31915)
+++ packages/python-pip/trunk/debian/changelog	2015-02-25 21:14:48 UTC (rev 31916)
@@ -1,3 +1,13 @@
+python-pip (1.5.6-5) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Use the .whl files for de-vendorized dependencies both inside and
+    outside the virtual environments.  (Closes: #744145)
+  * d/control: Bump Standards-Version with no other changes necessary.
+  * d/patches/use-venv-wheels.patch: Renamed to use-wheels.patch
+
+ -- Barry Warsaw <barry at debian.org>  Wed, 25 Feb 2015 15:24:29 -0500
+
 python-pip (1.5.6-4) unstable; urgency=medium
 
   * Team upload.

Modified: packages/python-pip/trunk/debian/control
===================================================================
--- packages/python-pip/trunk/debian/control	2015-02-25 18:46:44 UTC (rev 31915)
+++ packages/python-pip/trunk/debian/control	2015-02-25 21:14:48 UTC (rev 31916)
@@ -19,7 +19,7 @@
                python3-scripttest,
                python3-setuptools,
                python3-wheel
-Standards-Version: 3.9.5
+Standards-Version: 3.9.6
 X-Python-Version: >= 2.6
 X-Python3-Version: >= 3.2
 Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/python-pip/trunk/

Modified: packages/python-pip/trunk/debian/patches/series
===================================================================
--- packages/python-pip/trunk/debian/patches/series	2015-02-25 18:46:44 UTC (rev 31915)
+++ packages/python-pip/trunk/debian/patches/series	2015-02-25 21:14:48 UTC (rev 31916)
@@ -1,5 +1,5 @@
 de-vendorize.patch
-use-venv-wheels.patch
+use-wheels.patch
 better-error-message.patch
 random-install-dir.patch
 no-touch-system-files.patch

Deleted: packages/python-pip/trunk/debian/patches/use-venv-wheels.patch
===================================================================
--- packages/python-pip/trunk/debian/patches/use-venv-wheels.patch	2015-02-25 18:46:44 UTC (rev 31915)
+++ packages/python-pip/trunk/debian/patches/use-venv-wheels.patch	2015-02-25 21:14:48 UTC (rev 31916)
@@ -1,84 +0,0 @@
-Description: When inside a virtual environment (venv), we need to add
- all the recursively devendorized dependent wheels to sys.path so that they
- can be imported.  These should not live outside the venv (i.e. in system
- paths) in order to preserve venv isolation.  This patch works with the
- following scenarios: Python 2 (virtualenv), Python 3 (virtualenv, pyvenv).
-Author: Barry Warsaw <barry at debian.org>
-Forwarded: not-needed
-
---- a/pip/__init__.py
-+++ b/pip/__init__.py
-@@ -4,6 +4,56 @@
- 
- import sys
- import re
-+import errno
-+
-+# Debian virtual environment (venv) support.  When inside a venv, we have to
-+# add all the devendorized wheels to sys.path from inside the venv, otherwise
-+# the devendorized packages won't be found.  Only do this in a venv so it
-+# doesn't affect global pip operation.  venv determination is a bit of a black
-+# art, but this algorithm should work in both Python 2 (virtualenv-only) and
-+# Python 3 (pyvenv and virtualenv).  - barry at debian.org 2014-06-03
-+base_prefix = getattr(sys, 'base_prefix', None)
-+real_prefix = getattr(sys, 'real_prefix', None)
-+if base_prefix is None:
-+    # Python 2 has no base_prefix at all.  It also has no pyvenv.  Fall back
-+    # to checking real_prefix.
-+    if real_prefix is None:
-+        # We are not in a venv.
-+        in_venv = False
-+    else:
-+        # We're in a Python 2 virtualenv created venv, but real_prefix should
-+        # never be the same as sys.prefix.
-+        assert sys.prefix != real_prefix
-+        in_venv = True
-+elif sys.prefix != base_prefix:
-+    # We're in a Python 3, pyvenv created venv.
-+    in_venv = True
-+elif real_prefix is None:
-+    # We're in Python 3, outside a venv, but base better equal prefix.
-+    assert sys.prefix == base_prefix
-+    in_venv = False
-+else:
-+    # We're in a Python 3, virtualenv created venv.
-+    assert real_prefix != sys.prefix
-+    in_venv = True
-+
-+
-+if in_venv:
-+    wheel_dir = os.path.join(sys.prefix, 'lib', 'python-wheels')
-+    # We'll add all the wheels we find to the front of sys.path so that
-+    # they're found first, even if the same dependencies are available in
-+    # site-packages.  When pyvenv initializes the venv by calling `$python -Im
-+    # ensurepip`, it'll only copy the wheels needed to make pip work into this
-+    # directory, so we can just add them all.
-+    try:
-+        for filename in os.listdir(wheel_dir):
-+            if os.path.splitext(filename)[1] == '.whl':
-+                sys.path.insert(0, os.path.join(wheel_dir, filename))
-+    # FileNotFoundError doesn't exist in Python 2, but ignore it anyway.
-+    except OSError as error:
-+        if error.errno != errno.ENOENT:
-+            raise
-+
- 
- from pip.exceptions import InstallationError, CommandError, PipError
- from pip.log import logger
---- a/setup.py
-+++ b/setup.py
-@@ -41,7 +41,13 @@
- long_description = "\n" + "\n".join([read('PROJECT.txt'),
-                                      read('docs', 'quickstart.rst')])
- 
--tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock']
-+tests_require = ['pytest', 'scripttest>=1.3', 'mock']
-+
-+# In Debian, the virtualenv Build-Depends will satisfy this requirement
-+# but setup() is too dumb to notice that.
-+if sys.version_info < (3,):
-+    tests_require.append('virtualenv>=1.10')
-+
- 
- setup(name="pip",
-       version=find_version('pip', '__init__.py'),

Added: packages/python-pip/trunk/debian/patches/use-wheels.patch
===================================================================
--- packages/python-pip/trunk/debian/patches/use-wheels.patch	                        (rev 0)
+++ packages/python-pip/trunk/debian/patches/use-wheels.patch	2015-02-25 21:14:48 UTC (rev 31916)
@@ -0,0 +1,96 @@
+Description: We need to add all the recursively devendorized dependent wheels
+ to sys.path so that they can be imported.  These wheel files live in
+ different places depending on whether we're inside or outside a virtual
+ environment.
+Author: Barry Warsaw <barry at debian.org>
+Forwarded: not-needed
+
+--- a/pip/__init__.py
++++ b/pip/__init__.py
+@@ -4,6 +4,69 @@
+ 
+ import sys
+ import re
++import errno
++
++# Upstream pip vendorizes a bunch of its dependencies.  Debian de-vendorizes
++# (unbundles) these dependencies to be compliant with Debian policy.  Instead,
++# these dependencies are packaged as wheel (.whl) files in a known location.
++# When pip itself executes, we have to arrange for these wheels to show up
++# earlier on sys.path than any  other version of these packages, otherwise
++# things can break.  See for example Bug #744145.
++#
++# The location of the wheels differs depending on whether we're inside or
++# outside a virtual environment, regardless of whether that venv was created
++# with virtualenv or pyvenv.  The first thing we have to do is figure out if
++# we're inside or outside a venv, then search the appropriate wheel directory
++# and add all the .whls found there to the front of sys.path.  As per Debian
++# Python Policy, only the wheels needed to support this de-vendorization will
++# be present, so it's safe to add them all.
++#
++# venv determination is a bit of a black art, but this algorithm should work
++# in both Python 2 (virtualenv-only) and Python 3 (pyvenv and virtualenv).  -
++# updated by barry at debian.org 2015-02-25
++
++base_prefix = getattr(sys, 'base_prefix', None)
++real_prefix = getattr(sys, 'real_prefix', None)
++if base_prefix is None:
++    # Python 2 has no base_prefix at all.  It also has no pyvenv.  Fall back
++    # to checking real_prefix.
++    if real_prefix is None:
++        # We are not in a venv.
++        in_venv = False
++    else:
++        # We're in a Python 2 virtualenv created venv, but real_prefix should
++        # never be the same as sys.prefix.
++        assert sys.prefix != real_prefix
++        in_venv = True
++elif sys.prefix != base_prefix:
++    # We're in a Python 3, pyvenv created venv.
++    in_venv = True
++elif real_prefix is None:
++    # We're in Python 3, outside a venv, but base better equal prefix.
++    assert sys.prefix == base_prefix
++    in_venv = False
++else:
++    # We're in a Python 3, virtualenv created venv.
++    assert real_prefix != sys.prefix
++    in_venv = True
++
++
++if in_venv:
++    wheel_dir = os.path.join(sys.prefix, 'lib', 'python-wheels')
++else:
++    wheel_dir = '/usr/share/python-wheels'
++
++# We'll add all the wheels we find to the front of sys.path so that they're
++# found first, even if the same dependencies are available in site-packages.
++try:
++    for filename in os.listdir(wheel_dir):
++        if os.path.splitext(filename)[1] == '.whl':
++            sys.path.insert(0, os.path.join(wheel_dir, filename))
++# FileNotFoundError doesn't exist in Python 2, but ignore it anyway.
++except OSError as error:
++    if error.errno != errno.ENOENT:
++        raise
++
+ 
+ from pip.exceptions import InstallationError, CommandError, PipError
+ from pip.log import logger
+--- a/setup.py
++++ b/setup.py
+@@ -41,7 +41,13 @@
+ long_description = "\n" + "\n".join([read('PROJECT.txt'),
+                                      read('docs', 'quickstart.rst')])
+ 
+-tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock']
++tests_require = ['pytest', 'scripttest>=1.3', 'mock']
++
++# In Debian, the virtualenv Build-Depends will satisfy this requirement
++# but setup() is too dumb to notice that.
++if sys.version_info < (3,):
++    tests_require.append('virtualenv>=1.10')
++
+ 
+ setup(name="pip",
+       version=find_version('pip', '__init__.py'),




More information about the Python-modules-commits mailing list