Package: unittest2
Version: 0.8.0-1
Followup-For: Bug #777645
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu wily ubuntu-patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * Add Python 3 support:
    - d/control: Add python3-unittest2 binary package, update BD's.
    - d/rules: Ensure unit2 binaries are prefixed with python version.
    - d/*.postinst,prerm: Use alternatives for /usr/bin/unit2.
    - d/p/drop-argparse.patch: Drop argparse from list of dependencies,
      its not required and confuses the Python 3 tests.
  * d/source/options: Ignore any egg related changes, making package
    build more reproducable.
  * Wrap and sort.

This includes the Python 3 support requested in this bug.

Thanks for considering the patch.


-- System Information:
Debian Release: jessie/sid
  APT prefers wily-updates
  APT policy: (500, 'wily-updates'), (500, 'wily-security'), (500, 'wily'), 
(100, 'wily-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.19.0-20-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru unittest2-0.8.0/debian/control unittest2-0.8.0/debian/control
--- unittest2-0.8.0/debian/control	2015-03-19 21:33:21.000000000 +0000
+++ unittest2-0.8.0/debian/control	2015-06-19 11:04:15.000000000 +0100
@@ -4,7 +4,14 @@
 Maintainer: Debian Python Modules Team <python-modules-t...@lists.alioth.debian.org>
 Uploaders: Zygmunt Krynicki <zygmunt.kryni...@canonical.com>
 Build-Depends: debhelper (>= 7.4.2), dh-python
-Build-Depends-Indep: python-all, python-setuptools, python-pkg-resources, python-six
+Build-Depends-Indep: python-all,
+                     python-pkg-resources,
+                     python-setuptools,
+                     python-six,
+                     python3-all,
+                     python3-pkg-resources,
+                     python3-setuptools,
+                     python3-six
 Standards-Version: 3.9.6
 XS-Python-Version: all
 Homepage: http://pypi.python.org/pypi/unittest2
@@ -14,7 +21,7 @@
 
 Package: python-unittest2
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
+Depends: python-pkg-resources, ${misc:Depends}, ${python:Depends}
 Description: backport of the enhanced unittest testing framework in Python 2.7
  unittest2 is an enhanced version of unittest including a
  standard test runner (automatic test discovery), class and
@@ -24,3 +31,20 @@
  features are *all* going into the Python version of unittest in
  Python 2.7 and Python 3.2. The point of unittest2 is that it
  works with Python 2.4 - 2.6; you can use it now.
+ .
+ This package contains the Python 2.x module.
+
+Package: python3-unittest2
+Architecture: all
+Depends: python3-pkg-resources, ${misc:Depends}, ${python3:Depends}
+Description: backport of the enhanced unittest testing framework in Python 2.7
+ unittest2 is an enhanced version of unittest including a
+ standard test runner (automatic test discovery), class and
+ module level fixtures (``setUpClass`` / ``setUpModule`` etc),
+ many powerful new assert methods, better resource management
+ with ``addCleanups`` and a host of other new features. These new
+ features are *all* going into the Python version of unittest in
+ Python 2.7 and Python 3.2. The point of unittest2 is that it
+ works with Python 2.4 - 2.6; you can use it now.
+ .
+ This package contains the Python 3.x module.
diff -Nru unittest2-0.8.0/debian/patches/drop-argparse.patch unittest2-0.8.0/debian/patches/drop-argparse.patch
--- unittest2-0.8.0/debian/patches/drop-argparse.patch	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/patches/drop-argparse.patch	2015-06-19 11:02:36.000000000 +0100
@@ -0,0 +1,17 @@
+Description: Drop requirement for argparse
+ Ubuntu and Debian both ship minimum python versions that include
+ argparse; drop this from REQUIRES as its breaks the py3 unit tests
+Author: James Page <james.p...@ubuntu.com>
+Forwarded: not-needed
+
+--- a/setup.py
++++ b/setup.py
+@@ -57,7 +57,7 @@ KEYWORDS = "unittest testing tests".spli
+ # Both install and setup requires - because we read VERSION from within the
+ # package, and the package also exports all the APIs.
+ # six for compat helpers
+-REQUIRES = ['argparse', 'six'],
++REQUIRES = ['six'],
+ 
+ params = dict(
+     name=NAME,
diff -Nru unittest2-0.8.0/debian/patches/series unittest2-0.8.0/debian/patches/series
--- unittest2-0.8.0/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/patches/series	2015-06-19 10:23:28.000000000 +0100
@@ -0,0 +1 @@
+drop-argparse.patch
diff -Nru unittest2-0.8.0/debian/python3-unittest2.postinst unittest2-0.8.0/debian/python3-unittest2.postinst
--- unittest2-0.8.0/debian/python3-unittest2.postinst	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/python3-unittest2.postinst	2015-06-19 10:29:00.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+	update-alternatives --install /usr/bin/unit2 unit2 /usr/bin/python3-unit2 200
+fi
+
+#DEBHELPER#
+
+exit 0
diff -Nru unittest2-0.8.0/debian/python3-unittest2.prerm unittest2-0.8.0/debian/python3-unittest2.prerm
--- unittest2-0.8.0/debian/python3-unittest2.prerm	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/python3-unittest2.prerm	2015-06-19 10:29:00.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] ; then
+	update-alternatives --remove unit2 /usr/bin/python3-unit2
+fi
+
+#DEBHELPER#
+
+exit 0
diff -Nru unittest2-0.8.0/debian/python-unittest2.postinst unittest2-0.8.0/debian/python-unittest2.postinst
--- unittest2-0.8.0/debian/python-unittest2.postinst	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/python-unittest2.postinst	2015-06-19 10:29:00.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+	update-alternatives --install /usr/bin/unit2 unit2 /usr/bin/python2-unit2 300
+fi
+
+#DEBHELPER#
+
+exit 0
diff -Nru unittest2-0.8.0/debian/python-unittest2.prerm unittest2-0.8.0/debian/python-unittest2.prerm
--- unittest2-0.8.0/debian/python-unittest2.prerm	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/python-unittest2.prerm	2015-06-19 10:29:00.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] ; then
+	update-alternatives --remove unit2 /usr/bin/python2-unit2
+fi
+
+#DEBHELPER#
+
+exit 0
diff -Nru unittest2-0.8.0/debian/rules unittest2-0.8.0/debian/rules
--- unittest2-0.8.0/debian/rules	2015-03-06 19:23:46.000000000 +0000
+++ unittest2-0.8.0/debian/rules	2015-06-19 10:29:19.000000000 +0100
@@ -2,7 +2,12 @@
 export PYBUILD_NAME=unittest2
 
 %:
-	dh $@ --with=python2 --buildsystem=pybuild
+	dh $@ --with=python2,python3 --buildsystem=pybuild
+
+override_dh_install:
+	dh_install
+	mv $(CURDIR)/debian/python-unittest2/usr/bin/unit2 $(CURDIR)/debian/python-unittest2/usr/bin/python2-unit2
+	mv $(CURDIR)/debian/python3-unittest2/usr/bin/unit2 $(CURDIR)/debian/python3-unittest2/usr/bin/python3-unit2
 
 # Tests cannot run without unittest2 running them.
 # See: https://code.google.com/p/unittest-ext/issues/detail?id=93 for details
diff -Nru unittest2-0.8.0/debian/source/options unittest2-0.8.0/debian/source/options
--- unittest2-0.8.0/debian/source/options	1970-01-01 01:00:00.000000000 +0100
+++ unittest2-0.8.0/debian/source/options	2015-06-19 10:25:48.000000000 +0100
@@ -0,0 +1 @@
+extend-diff-ignore = "^[^/]*[.]egg.*/"

Reply via email to