Merge ~bryce/ubuntu/+source/nose:fix-lp1859880-py3-sphinx into ubuntu/+source/nose:ubuntu/focal-devel

Proposed by Bryce Harrington
Status: Superseded
Proposed branch: ~bryce/ubuntu/+source/nose:fix-lp1859880-py3-sphinx
Merge into: ubuntu/+source/nose:ubuntu/focal-devel
Diff against target: 104 lines (+18/-23)
3 files modified
debian/changelog (+9/-0)
debian/control (+6/-17)
debian/rules (+3/-6)
Reviewer Review Type Date Requested Status
git-ubuntu developers Pending
Review via email: mp+377754@code.launchpad.net

This proposal has been superseded by a proposal from 2020-01-17.

Description of the change

Several packages are blocked in proposed migration due to having nose as a dependency for their testsuites. Nose has been ported to python3, but the issue is that its code docs are being generated using the python2 version of sphinx.

I considered a few different ways to fix this:

1. Disable code docs. Nose is no longer maintained and upstream recommends using nose2 or pytest instead, so providing code docs may not be very important anymore, as developers should probably not use it anymore. However, the module still works well enough and is widely used so this seems too brute force.
2. Carry a debian patch to convert codebase to python3. With Ubuntu moving towards python3-only, there is little need for preserving python2 support. However, such a patch would touch a lot of code files and thus be brittle and require regeneration if debian changes things.
3. Generate docs from the build output rather than the source.
4. Add 2to3 as a dependency, and run it on the codebase prior to calling sphinx.

I experimented with #3 for a while, but didn't find a clean and robust way to do it. I'm not certain it would produce exactly the same results as generation from source, although that might not matter in practice.

Option #4, running 2to3, works cleanly and is minimally invasive. The main trade-off is it adds another dependency for the package, but this seems a fair trade.

A PPA with this package is available from:
  https://launchpad.net/~bryce/+archive/ubuntu/nose-fix-lp1859880-py3-sphinx/+packages

To post a comment you must log in.

Unmerged commits

24f5a96... by Bryce Harrington

changelog

8dd1f12... by Bryce Harrington

update-maintainer

8f64234... by Bryce Harrington

d/control: Use the python3 version of the coverage module

7a0f3db... by Bryce Harrington

d/control, d/rules: Use the python3 version of sphinx

Convert codebase to python3 before generating code docs

nose's root codebase has some py2-isms, which are fixed up during
setup.py's build via setup3lib.py and setuptool's 2to3 mechanisms.
Unfortunately, sphinx doesn't see these changes and tries to build docs
from the original (python2) codebase.

Previously, the python2 version of sphinx was being used to generate the
docs, so this was not a problem. However, when using python3-sphinx, it
errors when it encounters python2 source. Address this by running 2to3
over the codebase before calling sphinx.

665ffe5... by Bryce Harrington

d/rules, d/control: Drop python2 binary package

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index e1949b7..d289d22 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+nose (1.3.7-4ubuntu1) focal; urgency=medium
7+
8+ * Drop python2 support (LP: #1859880)
9+ - d/control: Switch to py3 versions of coverage and sphinx modules
10+ - d/rules: Force 2to3 when generating code docs with sphinx
11+ - d/rules, d/control: Drop py2 binary package
12+
13+ -- Bryce Harrington <bryce@canonical.com> Thu, 16 Jan 2020 20:20:35 +0000
14+
15 nose (1.3.7-4build1) focal; urgency=medium
16
17 * No-change rebuild to generate dependencies on python2.
18diff --git a/debian/control b/debian/control
19index 752b5c2..c6e7e46 100644
20--- a/debian/control
21+++ b/debian/control
22@@ -1,7 +1,8 @@
23 Source: nose
24 Section: python
25 Priority: optional
26-Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
27+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
28+XSBC-Original-Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
29 Uploaders:
30 Torsten Marek <shlomme@debian.org>,
31 Dmitry Shachnev <mitya57@debian.org>,
32@@ -12,13 +13,11 @@ Build-Depends:
33 libjs-jquery-hotkeys,
34 libjs-jquery-isonscreen,
35 libjs-jquery-tablesorter,
36- python-all (>= 2.6.6-3~),
37- python-setuptools (>= 0.6a9),
38- python-sphinx (>= 1.0.7+dfsg),
39- python-coverage,
40+ python3-coverage,
41+ python3-sphinx (>= 1.0.7+dfsg),
42 python3-all,
43- python3-setuptools
44-X-Python-Version: >= 2.5
45+ python3-setuptools,
46+ 2to3
47 X-Python3-Version: >= 3.2
48 Standards-Version: 4.1.3
49 Homepage: https://nose.readthedocs.io/en/latest/
50@@ -37,16 +36,6 @@ Description: documentation for discovery and running for Python's unittest
51 .
52 This package provides the documentation for nose.
53
54-Package: python-nose
55-Architecture: all
56-Multi-Arch: foreign
57-Depends: python-pkg-resources, ${misc:Depends}, ${python:Depends}
58-Suggests: python-coverage, python-nose-doc
59-Description: test discovery and running of Python's unittest
60- nose provides an alternate test discovery and running process for
61- unittest, one that is intended to mimic the behavior of py.test as
62- much as is reasonably possible without resorting to too much magic
63-
64 Package: python3-nose
65 Architecture: all
66 Multi-Arch: foreign
67diff --git a/debian/rules b/debian/rules
68index c48a026..6007e02 100755
69--- a/debian/rules
70+++ b/debian/rules
71@@ -1,30 +1,27 @@
72 #!/usr/bin/make -f
73
74-DESTDIR2 := $(CURDIR)/debian/python-nose
75 DESTDIR3 := $(CURDIR)/debian/python3-nose
76
77 export PYBUILD_NAME = nose
78-export PYBUILD_TEST_ARGS_python2 = {interpreter} setup.py test
79 export PYBUILD_TEST_ARGS_python3 = {interpreter} setup.py build_tests && {interpreter} selftest.py -v
80
81 %:
82- dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
83+ dh $@ --with python3,sphinxdoc --buildsystem=pybuild
84
85 override_dh_auto_build:
86 dh_auto_build
87- python setup.py build_sphinx
88+ 2to3 -w --no-diffs --nobackups nose
89+ python3 setup.py build_sphinx
90
91 override_dh_auto_test:
92 dh_auto_test -- --system=custom
93
94 override_dh_auto_install:
95 dh_auto_install
96- sed -i -e 's,#!/usr/bin/python.*,#!/usr/bin/python,' $(DESTDIR2)/usr/bin/nosetests
97 cd $(DESTDIR3)/usr/bin/ && mv nosetests nosetests3
98 rm -f $(DESTDIR3)/usr/bin/nosetests-3.*
99 sed -i -e 's,#!/usr/bin/python3.*,#!/usr/bin/python3,' $(DESTDIR3)/usr/bin/nosetests3
100
101 override_dh_installman:
102- dh_installman -p python-nose nosetests.1
103 dh_installman -p python3-nose nosetests.1
104 cd $(DESTDIR3)/usr/share/man/man1 && mv nosetests.1 nosetests3.1

Subscribers

People subscribed via source and target branches