[Python-modules-commits] r29238 - in packages/python-virtualenv/trunk/debian (11 files)

barry at users.alioth.debian.org barry at users.alioth.debian.org
Fri Jun 6 16:16:52 UTC 2014


    Date: Friday, June 6, 2014 @ 16:16:50
  Author: barry
Revision: 29238

* Team upload.
* New upstream release.
* /usr/bin/virtualenv is now a Python 3 application.  As an import, the
  virtualenv module is only available for Python 3 now (needed by tox
  and with no other effects in the archive).
* d/control:
  - Depend on the appropriate -whl packages to properly de-vendorize,
    and switch to python3 and python3-pkg-resources.
  - Build-Depends: add dh-python, and switch to python3-all.
  - Build-Depends-Indep: add python-pip-whl and python-setuptools-whl.
  - Add myself to Uploaders.
  - Add X-Python3-Version.
  - Change Recommends to python3-pip.
  - wrap-and-sort
* d/install: Don't install the .whl files into
  /usr/share/python-virtualenv.  Now we use the policy-approved location
  of /usr/share/python-wheels, and we use the archive's python-*-whl
  packages.
* d/patches:
  - look_for_external_files.patch: Removed.  This patch is obsoleted by
    user-wheels.patch.
  - entry-points.patch: Update my email address.
  - python2-default.patch: Added; continue to use `python2` as default
    unless the -p/--python option is given.
  - use-wheels.patch: Added; use the system -whl packages instead of the
    vendorized versions.
  - system-python.patch: Update to /usr/bin/python3 shebang.
* d/rules: Switch to pybuild and simplify.  Now that we're using the
  system wheels, we don't need to repack the bundled versions.

Added:
  packages/python-virtualenv/trunk/debian/patches/python2-default.patch
  packages/python-virtualenv/trunk/debian/patches/use-wheels.patch
Modified:
  packages/python-virtualenv/trunk/debian/changelog
  packages/python-virtualenv/trunk/debian/control
  packages/python-virtualenv/trunk/debian/install
  packages/python-virtualenv/trunk/debian/patches/entry-points.patch
  packages/python-virtualenv/trunk/debian/patches/series
  packages/python-virtualenv/trunk/debian/patches/system-python.patch
  packages/python-virtualenv/trunk/debian/rules
Deleted:
  packages/python-virtualenv/trunk/debian/patches/look_for_external_files.patch
  packages/python-virtualenv/trunk/debian/patches/pip_non-writeable-home.patch

Modified: packages/python-virtualenv/trunk/debian/changelog
===================================================================
--- packages/python-virtualenv/trunk/debian/changelog	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/changelog	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,3 +1,37 @@
+python-virtualenv (1.11.6-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+  * /usr/bin/virtualenv is now a Python 3 application.  As an import, the
+    virtualenv module is only available for Python 3 now (needed by tox
+    and with no other effects in the archive).
+  * d/control:
+    - Depend on the appropriate -whl packages to properly de-vendorize,
+      and switch to python3 and python3-pkg-resources.
+    - Build-Depends: add dh-python, and switch to python3-all.
+    - Build-Depends-Indep: add python-pip-whl and python-setuptools-whl.
+    - Add myself to Uploaders.
+    - Add X-Python3-Version.
+    - Change Recommends to python3-pip.
+    - wrap-and-sort
+  * d/install: Don't install the .whl files into
+    /usr/share/python-virtualenv.  Now we use the policy-approved location
+    of /usr/share/python-wheels, and we use the archive's python-*-whl
+    packages.
+  * d/patches:
+    - look_for_external_files.patch: Removed.  This patch is obsoleted by
+      user-wheels.patch.
+    - entry-points.patch: Update my email address.
+    - python2-default.patch: Added; continue to use `python2` as default
+      unless the -p/--python option is given.
+    - use-wheels.patch: Added; use the system -whl packages instead of the
+      vendorized versions.
+    - system-python.patch: Update to /usr/bin/python3 shebang.
+  * d/rules: Switch to pybuild and simplify.  Now that we're using the
+    system wheels, we don't need to repack the bundled versions.
+
+ -- Barry Warsaw <barry at debian.org>  Mon, 02 Jun 2014 17:09:11 -0400
+
 python-virtualenv (1.11.4-1) unstable; urgency=medium
 
   * Team upload.

Modified: packages/python-virtualenv/trunk/debian/control
===================================================================
--- packages/python-virtualenv/trunk/debian/control	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/control	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,27 +1,32 @@
 Source: python-virtualenv
 Section: python
 Priority: optional
-X-Python-Version: >= 2.5
 Maintainer: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org>
-Uploaders:
- Carl Chenet <chaica at ohmytux.com>,
- Jeff Licquia <licquia at debian.org>,
- Stefano Rivera <stefanor at debian.org>
+Uploaders: Carl Chenet <chaica at ohmytux.com>,
+           Jeff Licquia <licquia at debian.org>,
+           Stefano Rivera <stefanor at debian.org>,
+           Barry Warsaw <barry at debian.org>
 Homepage: http://pypi.python.org/pypi/virtualenv
 Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/python-virtualenv/trunk/
 Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/python-virtualenv/trunk/
-Build-Depends: debhelper (>= 8.1), python (>= 2.6.6-3), zip, unzip
-Build-Depends-Indep: python-setuptools
+Build-Depends: debhelper (>= 8.1), dh-python, python3-all, unzip, zip
+Build-Depends-Indep: python-pip-whl,
+                     python-setuptools-whl,
+                     python3-mock,
+                     python3-nose,
+                     python3-setuptools
 Standards-Version: 3.9.5
+X-Python3-Version: >= 3.3
 
 Package: python-virtualenv
 Architecture: all
-Depends:
- python-pkg-resources,
- python-setuptools,
- ${misc:Depends},
- ${python:Depends}
-Recommends: python-pip (>= 0.7.2)
+Depends: python3,
+         python-pip-whl,
+         python-setuptools-whl,
+         python3-pkg-resources,
+         ${misc:Depends},
+         ${python3:Depends}
+Recommends: python3-pip (>= 0.7.2)
 Description: Python virtual environment creator
  The virtualenv utility creates virtual Python instances, each invokable
  with its own Python executable.  Each instance can have different sets

Modified: packages/python-virtualenv/trunk/debian/install
===================================================================
--- packages/python-virtualenv/trunk/debian/install	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/install	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,2 +1 @@
 scripts/virtualenv /usr/bin/
-virtualenv_support/*.whl /usr/share/python-virtualenv/

Modified: packages/python-virtualenv/trunk/debian/patches/entry-points.patch
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/entry-points.patch	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/patches/entry-points.patch	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,6 +1,6 @@
 Description: Prevent installation of virtualenv-X.Y since we're not
  providing these for every supported version.
-Author: Barry Warsaw <barry at python.org>
+Author: Barry Warsaw <barry at debian.org>
 Forwarded: no
 
 --- a/setup.py

Deleted: packages/python-virtualenv/trunk/debian/patches/look_for_external_files.patch
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/look_for_external_files.patch	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/patches/look_for_external_files.patch	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,26 +0,0 @@
-Description: store files in /usr/share/python-virtualenv/
-Author: Carl Chenet <chaica at ohmytux.com>
-
---- a/virtualenv.py
-+++ b/virtualenv.py
-@@ -526,7 +526,8 @@
- def file_search_dirs():
-     here = os.path.dirname(os.path.abspath(__file__))
-     dirs = ['.', here,
--            join(here, 'virtualenv_support')]
-+            #join(here, 'virtualenv_support')]
-+            '/usr/share/python-virtualenv/']
-     if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
-         # Probably some boot script; just in case virtualenv is installed...
-         try:
---- a/setup.py
-+++ b/setup.py
-@@ -84,6 +84,6 @@
-     url='http://www.virtualenv.org',
-     license='MIT',
-     py_modules=['virtualenv'],
--    packages=['virtualenv_support'],
--    package_data={'virtualenv_support': ['*.whl']},
-+    #packages=['virtualenv_support'],
-+    #package_data={'virtualenv_support': ['*.whl']},
-     **setup_params)

Deleted: packages/python-virtualenv/trunk/debian/patches/pip_non-writeable-home.patch
===================================================================
Added: packages/python-virtualenv/trunk/debian/patches/python2-default.patch
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/python2-default.patch	                        (rev 0)
+++ packages/python-virtualenv/trunk/debian/patches/python2-default.patch	2014-06-06 16:16:50 UTC (rev 29238)
@@ -0,0 +1,21 @@
+Description: Even though /usr/bin/virtualenv is a Python 3 script now, in
+ Debian we still want to default to using Python 2 unless the -p/--python
+ argument is given.
+Author: Barry Warsaw <barry at debian.org>
+Forwarded: not-needed
+
+--- a/virtualenv.py
++++ b/virtualenv.py
+@@ -670,9 +670,10 @@
+         '-p', '--python',
+         dest='python',
+         metavar='PYTHON_EXE',
++        default='python2',
+         help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
+-        'interpreter to create the new environment.  The default is the interpreter that '
+-        'virtualenv was installed with (%s)' % sys.executable)
++        'interpreter to create the new environment.  The default is the python2 '
++        'interpreter on your path (e.g. /usr/bin/python2)')
+ 
+     parser.add_option(
+         '--clear',

Modified: packages/python-virtualenv/trunk/debian/patches/series
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/series	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/patches/series	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,3 +1,4 @@
-look_for_external_files.patch
 system-python.patch
 entry-points.patch
+use-wheels.patch
+python2-default.patch

Modified: packages/python-virtualenv/trunk/debian/patches/system-python.patch
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/system-python.patch	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/patches/system-python.patch	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,12 +1,13 @@
-Description: Use /usr/bin/python in the shebang.
+Description: Use /usr/bin/python3 in the shebang.
 Bug-Debian: #663228
 Author: Stefano Rivera <stefanor at debian.org>
 Forwarded: not-needed
+Last-Update: 2014-06-02
 
 --- a/scripts/virtualenv
 +++ b/scripts/virtualenv
 @@ -1,3 +1,3 @@
 -#!/usr/bin/env python
-+#!/usr/bin/python
++#!/usr/bin/python3
  import virtualenv
  virtualenv.main()

Added: packages/python-virtualenv/trunk/debian/patches/use-wheels.patch
===================================================================
--- packages/python-virtualenv/trunk/debian/patches/use-wheels.patch	                        (rev 0)
+++ packages/python-virtualenv/trunk/debian/patches/use-wheels.patch	2014-06-06 16:16:50 UTC (rev 29238)
@@ -0,0 +1,101 @@
+Description: Use the archive's wheels instead of the bundled wheels, by
+ prepending their paths onto the front of sys.path.  Also, when the venv is
+ created, copy the system wheels into <venv>/lib/python-wheels for use by
+ our patched pip wheel.  Make sure the command line script uses the system
+ wheels first.
+Author: Barry Warsaw <barry at debian.org>
+Forwarded: not-needed
+
+--- a/scripts/virtualenv
++++ b/scripts/virtualenv
+@@ -1,3 +1,12 @@
+ #!/usr/bin/python3
+ import virtualenv
++
++# Debian: Barry Warsaw <barry at debian.org> 2014-06-02
++# Instead of using the bundled wheels, use the ones in the archive.
++import sys
++for path in virtualenv.find_wheels(virtualenv.DEBIAN_WHEEL_DEPS,
++                                   ['/usr/share/python-wheels']):
++    if path not in sys.path:
++        sys.path.insert(0, path)
++
+ virtualenv.main()
+--- a/setup.py
++++ b/setup.py
+@@ -83,6 +83,6 @@
+     url='https://virtualenv.pypa.io/',
+     license='MIT',
+     py_modules=['virtualenv'],
+-    packages=['virtualenv_support'],
+-    package_data={'virtualenv_support': ['*.whl']},
++    #packages=['virtualenv_support'],
++    #package_data={'virtualenv_support': ['*.whl']},
+     **setup_params)
+--- a/virtualenv.py
++++ b/virtualenv.py
+@@ -23,6 +23,10 @@
+ import subprocess
+ import tarfile
+ 
++# Debian: Barry Warsaw <barry at debian.org> 2014-06-06
++DEBIAN_WHEEL_DEPS = ['chardet', 'colorama', 'distlib', 'html5lib',
++                     'pip', 'requests', 'setuptools', 'six', 'urllib3']
++
+ if sys.version_info < (2, 6):
+     print('ERROR: %s' % sys.exc_info()[1])
+     print('ERROR: this script requires Python 2.6 or greater.')
+@@ -526,7 +530,8 @@
+ def file_search_dirs():
+     here = os.path.dirname(os.path.abspath(__file__))
+     dirs = ['.', here,
+-            join(here, 'virtualenv_support')]
++            #join(here, 'virtualenv_support')]
++            '/usr/share/python-wheels/']
+     if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
+         # Probably some boot script; just in case virtualenv is installed...
+         try:
+@@ -855,7 +860,16 @@
+             for varname in remove_from_env:
+                 env.pop(varname, None)
+     else:
+-        env = None
++        env = {}
++    # Debian: Barry Warsaw <barry at debian.org> 2014-06-06
++    # We're about to execute $python -c "import sys, pip ..." and run
++    # pip.main().  We have to make sure to find pip and setuptools via the
++    # wheels if they exist.
++    syspath_parts = env.get('PYTHONPATH', '').split(os.pathsep)
++    for path in find_wheels(DEBIAN_WHEEL_DEPS, ['/usr/share/python-wheels']):
++        if path not in syspath_parts:
++            syspath_parts.insert(0, path)
++    env['PYTHONPATH'] = os.pathsep.join(syspath_parts)
+     try:
+         proc = subprocess.Popen(
+             cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
+@@ -985,6 +999,25 @@
+ 
+     install_distutils(home_dir)
+ 
++    # Debian: Barry Warsaw <barry at debian.org> 2014-06-06
++    # Copy system wheels into the venv directory where our hacked pip will
++    # search, i.e. <venv>/lib/python-wheels.
++    destdir = os.path.join(home_dir, 'lib', 'python-wheels')
++    os.makedirs(destdir)
++    for project in DEBIAN_WHEEL_DEPS:
++        wheel_names = glob.glob(
++            '/usr/share/python-wheels/{}-*.whl'.format(project))
++        if len(wheel_names) == 0:
++            raise RuntimeError('missing dependency wheel %s' % project)
++        assert len(wheel_names) == 1, wheel_names
++        wheel_name = os.path.basename(wheel_names[0])
++        path = os.path.join('/usr/share/python-wheels', wheel_name)
++        with open(path, 'rb') as fp:
++            whl = fp.read()
++        dest = os.path.join(destdir, wheel_name)
++        with open(dest, 'wb') as fp:
++            fp.write(whl)
++
+     if not no_setuptools:
+         to_install = ['setuptools']
+         if not no_pip:

Modified: packages/python-virtualenv/trunk/debian/rules
===================================================================
--- packages/python-virtualenv/trunk/debian/rules	2014-06-06 15:57:26 UTC (rev 29237)
+++ packages/python-virtualenv/trunk/debian/rules	2014-06-06 16:16:50 UTC (rev 29238)
@@ -1,29 +1,22 @@
 #!/usr/bin/make -f
 
-PIP_WHL=$(CURDIR)/virtualenv_support/pip-1.5.4-py2.py3-none-any.whl
-PIP_WHL_PATCHED=$(CURDIR)/virtualenv_support/pip-1.5debian1-py2.py3-none-any.whl
+# This doesn't actually help.
+export PYBUILD_NAME=virtualenv
 
 %:
-	dh $@ --with python2
+	dh $@ --with python3 --buildsystem=pybuild
 
 override_dh_auto_configure:
-	# Patch the bundled pip
-	[ -e $(PIP_WHL).orig ] || mv $(PIP_WHL) $(PIP_WHL).orig
-	mkdir -p debian/pip
-	unzip -d debian/pip $(PIP_WHL).orig
-	# Add any necessary embedded pip patch applications here, e.g.
-	#patch -d debian/pip -p1 < debian/patches/pip_non-writeable-home.patch
-	cd debian/pip && zip -r $(PIP_WHL_PATCHED) .
-	# Rebuild the embedded parts, we may be quilt patching their sources
-	[ -e virtualenv.py.orig ] || cp virtualenv.py virtualenv.py.orig
-	python bin/rebuild-script.py
+	# Remove the embedded wheels in favor of the -whl packages.
+	rm -f virtualenv_support/*.whl
 	dh_auto_configure
 
-override_dh_auto_clean:
-	[ ! -e virtualenv.py.orig ] || mv virtualenv.py.orig virtualenv.py
-	rm -rf debian/pip $(PIP_WHL_PATCHED)
-	[ ! -e $(PIP_WHL).orig ] || mv $(PIP_WHL).orig $(PIP_WHL)
-	dh_auto_clean
+override_dh_python3:
+	dh_python3 --shebang=/usr/bin/python3
+	# This is an ugly hack since pybuild doesn't seem to DTRT.
+	find debian/python-virtualenv -name __pycache__ | xargs rm -rf
+	mv debian/python-virtualenv/usr/lib/$(shell py3versions -d) \
+	   debian/python-virtualenv/usr/lib/python3
 
 override_dh_installchangelogs:
 	dh_installchangelogs docs/news.rst




More information about the Python-modules-commits mailing list