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

barry at users.alioth.debian.org barry at users.alioth.debian.org
Tue Jun 3 20:11:06 UTC 2014


    Date: Tuesday, June 3, 2014 @ 20:11:05
  Author: barry
Revision: 29195

* Team upload.
* New upstream release.
* d/control: Update python-pip-whl dependencies.
* d/patches/de-vendorize.patch: Refreshed.
* d/patches/use-venv-wheels.patch: Handle virtualenv created venvs.
* d/pip.dependencies: Added.  (Closes: #749692)
* d/python-pip-whl.install: Updated.
* d/README.debian: Added.

Added:
  packages/python-pip/trunk/debian/README.debian
  packages/python-pip/trunk/debian/pip.dependencies
Modified:
  packages/python-pip/trunk/debian/changelog
  packages/python-pip/trunk/debian/control
  packages/python-pip/trunk/debian/patches/de-vendorize.patch
  packages/python-pip/trunk/debian/patches/use-venv-wheels.patch
  packages/python-pip/trunk/debian/python-pip-whl.install

Added: packages/python-pip/trunk/debian/README.debian
===================================================================
--- packages/python-pip/trunk/debian/README.debian	                        (rev 0)
+++ packages/python-pip/trunk/debian/README.debian	2014-06-03 20:11:05 UTC (rev 29195)
@@ -0,0 +1,41 @@
+pip on Debian is a crazy mess due to upstream's vendorizing of several
+packages, which violates both the DFSG and Debian Policy.  To resolve this
+conflict, we package up these dependencies as PEP 427 wheels, essentially zip
+files containing importable pure-Python code and a metadata directory.  These
+wheels live in separate python-<pkg>-whl binary packages, and are installed
+into /usr/share/python-wheels.
+
+These wheels are not used when running pip outside of a virtual environment
+(venv).  In that case, it pip just uses the normal sys.path, on which it finds
+the dependencies installed into Debian's system Pythons in the normal way.
+However, an "outside-the-venv" pip cannot be used to install packages inside
+the venv, so the two main venv creation tools, virtualenv and pyvenv, make
+sure that the virtualenv has a pip executable, but of course in different
+ways.
+
+It gets trickier inside a venv, which by definition may be isolated from the
+system Python's sys.path.  In this case, Debian's inside-the-venv pip prepends
+the paths to the -whl files onto the front of sys.path, so that imports will
+Just Work and upgrades to the dependencies inside the venv won't break pip.
+(Yes, this can and has happened and we need to guard against it.)
+
+It's important to note that determining whether you are in a venv is a
+heuristic labyrinth, because the things you need to check are different
+between Python 2 and Python 3, and between virtualenv and pyvenv (Python
+3-only).  I think we've got it right <wink>.
+
+Python 3.4 introduced a module called "ensurepip" which is used - as its name
+describes - to ensure that there is a pip executable inside the pyvenv created
+venv.  ensurepip does this job by copying all of the dependent .whl files from
+/usr/share/python-wheels into the venv, where pip will look to put then on the
+front of sys.path.  The file /usr/share/python-wheels/pip.dependencies lists
+these dependent wheels, one-per-line, by project name, which is used as the
+prefix for a glob of .whl files (to avoid having to hard-code version numbers
+in the pip.dependencies and ensurepip/__init__.py files).
+
+/usr/share/python-wheels/pip.dependencies is owned by the python-pip-whl
+binary package.
+
+See Debian Python Policy $3.2 for additional details.
+
+ -- Barry Warsaw <barry at debian.org>, Tue,  3 Jun 2014 12:02:14 -0400

Modified: packages/python-pip/trunk/debian/changelog
===================================================================
--- packages/python-pip/trunk/debian/changelog	2014-06-03 07:45:02 UTC (rev 29194)
+++ packages/python-pip/trunk/debian/changelog	2014-06-03 20:11:05 UTC (rev 29195)
@@ -1,3 +1,16 @@
+python-pip (1.5.6-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+  * d/control: Update python-pip-whl dependencies.
+  * d/patches/de-vendorize.patch: Refreshed.
+  * d/patches/use-venv-wheels.patch: Handle virtualenv created venvs.
+  * d/pip.dependencies: Added.  (Closes: #749692)
+  * d/python-pip-whl.install: Updated.
+  * d/README.debian: Added.
+
+ -- Barry Warsaw <barry at debian.org>  Thu, 29 May 2014 18:48:06 -0400
+
 python-pip (1.5.5-1) unstable; urgency=medium
 
   * Team upload.

Modified: packages/python-pip/trunk/debian/control
===================================================================
--- packages/python-pip/trunk/debian/control	2014-06-03 07:45:02 UTC (rev 29194)
+++ packages/python-pip/trunk/debian/control	2014-06-03 20:11:05 UTC (rev 29195)
@@ -66,7 +66,15 @@
 
 Package: python-pip-whl
 Architecture: all
-Depends: ${misc:Depends}
+Depends: python-chardet-whl,
+         python-colorama-whl,
+         python-distlib-whl,
+         python-html5lib-whl,
+         python-requests-whl,
+         python-setuptools-whl,
+         python-six-whl,
+         python-urllib3-whl,
+         ${misc:Depends}
 Description: alternative Python package installer
  pip is a replacement for easy_install, and is intended to be an improved
  Python package installer.  It integrates with virtualenv, doesn't do partial

Modified: packages/python-pip/trunk/debian/patches/de-vendorize.patch
===================================================================
--- packages/python-pip/trunk/debian/patches/de-vendorize.patch	2014-06-03 07:45:02 UTC (rev 29194)
+++ packages/python-pip/trunk/debian/patches/de-vendorize.patch	2014-06-03 20:11:05 UTC (rev 29195)
@@ -144,7 +144,7 @@
            'pip%s=pip:main' % sys.version[:3]]),
 --- a/pip.egg-info/SOURCES.txt
 +++ b/pip.egg-info/SOURCES.txt
-@@ -49,188 +49,6 @@
+@@ -49,156 +49,6 @@
  pip.egg-info/not-zip-safe
  pip.egg-info/requires.txt
  pip.egg-info/top_level.txt
@@ -235,44 +235,6 @@
 -pip/_vendor/requests/structures.py
 -pip/_vendor/requests/utils.py
 -pip/_vendor/requests/packages/__init__.py
--pip/_vendor/requests/packages/charade/__init__.py
--pip/_vendor/requests/packages/charade/__main__.py
--pip/_vendor/requests/packages/charade/big5freq.py
--pip/_vendor/requests/packages/charade/big5prober.py
--pip/_vendor/requests/packages/charade/chardistribution.py
--pip/_vendor/requests/packages/charade/charsetgroupprober.py
--pip/_vendor/requests/packages/charade/charsetprober.py
--pip/_vendor/requests/packages/charade/codingstatemachine.py
--pip/_vendor/requests/packages/charade/compat.py
--pip/_vendor/requests/packages/charade/constants.py
--pip/_vendor/requests/packages/charade/cp949prober.py
--pip/_vendor/requests/packages/charade/escprober.py
--pip/_vendor/requests/packages/charade/escsm.py
--pip/_vendor/requests/packages/charade/eucjpprober.py
--pip/_vendor/requests/packages/charade/euckrfreq.py
--pip/_vendor/requests/packages/charade/euckrprober.py
--pip/_vendor/requests/packages/charade/euctwfreq.py
--pip/_vendor/requests/packages/charade/euctwprober.py
--pip/_vendor/requests/packages/charade/gb2312freq.py
--pip/_vendor/requests/packages/charade/gb2312prober.py
--pip/_vendor/requests/packages/charade/hebrewprober.py
--pip/_vendor/requests/packages/charade/jisfreq.py
--pip/_vendor/requests/packages/charade/jpcntx.py
--pip/_vendor/requests/packages/charade/langbulgarianmodel.py
--pip/_vendor/requests/packages/charade/langcyrillicmodel.py
--pip/_vendor/requests/packages/charade/langgreekmodel.py
--pip/_vendor/requests/packages/charade/langhebrewmodel.py
--pip/_vendor/requests/packages/charade/langhungarianmodel.py
--pip/_vendor/requests/packages/charade/langthaimodel.py
--pip/_vendor/requests/packages/charade/latin1prober.py
--pip/_vendor/requests/packages/charade/mbcharsetprober.py
--pip/_vendor/requests/packages/charade/mbcsgroupprober.py
--pip/_vendor/requests/packages/charade/mbcssm.py
--pip/_vendor/requests/packages/charade/sbcharsetprober.py
--pip/_vendor/requests/packages/charade/sbcsgroupprober.py
--pip/_vendor/requests/packages/charade/sjisprober.py
--pip/_vendor/requests/packages/charade/universaldetector.py
--pip/_vendor/requests/packages/charade/utf8prober.py
 -pip/_vendor/requests/packages/chardet/__init__.py
 -pip/_vendor/requests/packages/chardet/big5freq.py
 -pip/_vendor/requests/packages/chardet/big5prober.py
@@ -321,7 +283,6 @@
 -pip/_vendor/requests/packages/urllib3/poolmanager.py
 -pip/_vendor/requests/packages/urllib3/request.py
 -pip/_vendor/requests/packages/urllib3/response.py
--pip/_vendor/requests/packages/urllib3/util.py
 -pip/_vendor/requests/packages/urllib3/contrib/__init__.py
 -pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py
 -pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
@@ -330,10 +291,17 @@
 -pip/_vendor/requests/packages/urllib3/packages/six.py
 -pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py
 -pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
+-pip/_vendor/requests/packages/urllib3/util/__init__.py
+-pip/_vendor/requests/packages/urllib3/util/connection.py
+-pip/_vendor/requests/packages/urllib3/util/request.py
+-pip/_vendor/requests/packages/urllib3/util/response.py
+-pip/_vendor/requests/packages/urllib3/util/ssl_.py
+-pip/_vendor/requests/packages/urllib3/util/timeout.py
+-pip/_vendor/requests/packages/urllib3/util/url.py
  pip/backwardcompat/__init__.py
  pip/commands/__init__.py
  pip/commands/bundle.py
-@@ -249,4 +67,4 @@
+@@ -217,4 +67,4 @@
  pip/vcs/bazaar.py
  pip/vcs/git.py
  pip/vcs/mercurial.py

Modified: packages/python-pip/trunk/debian/patches/use-venv-wheels.patch
===================================================================
--- packages/python-pip/trunk/debian/patches/use-venv-wheels.patch	2014-06-03 07:45:02 UTC (rev 29194)
+++ packages/python-pip/trunk/debian/patches/use-venv-wheels.patch	2014-06-03 20:11:05 UTC (rev 29195)
@@ -1,22 +1,50 @@
-Description: When inside a pyvenv created virtual environment, we need to add
+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.
+ 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
-@@ -5,6 +5,26 @@
+@@ -5,6 +5,53 @@
  import sys
  import re
  
-+# Debian pyvenv support.  When inside a pyvenv created virtual environment, 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.  Python 2 does not have a
-+# sys.base_prefix attribute.
-+if sys.prefix != getattr(sys, 'base_prefix', sys.prefix):
++# 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

Added: packages/python-pip/trunk/debian/pip.dependencies
===================================================================
--- packages/python-pip/trunk/debian/pip.dependencies	                        (rev 0)
+++ packages/python-pip/trunk/debian/pip.dependencies	2014-06-03 20:11:05 UTC (rev 29195)
@@ -0,0 +1,8 @@
+chardet
+colorama
+distlib
+html5lib
+requests
+setuptools
+six
+urllib3

Modified: packages/python-pip/trunk/debian/python-pip-whl.install
===================================================================
--- packages/python-pip/trunk/debian/python-pip-whl.install	2014-06-03 07:45:02 UTC (rev 29194)
+++ packages/python-pip/trunk/debian/python-pip-whl.install	2014-06-03 20:11:05 UTC (rev 29195)
@@ -1 +1,2 @@
 usr/share/python-wheels
+debian/pip.dependencies usr/share/python-wheels




More information about the Python-modules-commits mailing list