[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Gotcha: Python 3.4, 2to3, and deprecated assert methods



A quick note that might be of interest to maintainers as they build their
packages for Python 3.4 and 3.3.  I just encountered this with Genshi.  Thanks
to Piotr and Sebastian Ramacher for the discussion on #debian-python.

Genshi uses 2to3 to produce Python 3 compatible files from its Python 2
source.  Python 3.4 added a new 2to3 fixer to rewrite deprecated unittest
assert methods into their currently recommended names.  Genshi's test suite
contains some of these deprecated methods.

The effect of this is that the output of 2to3 is different in Python 3.3
vs. Python 3.4.  That causes dh_python3 to not copy the 3.4 paths into the
common installation location, i.e. /usr/lib/python3/dist-packages/genshi
Thus the python3-genshi binary package included a few /usr/lib/python3.4
files, which lintian complains about.

There are a few ways to solve this problem.  Sebastian encountered this in
python-crypto and wrote a quilt patch that pre-rewrites the deprecated methods
into their new names.  Thus 2to3 would have no effect on these files, they'd
be the same in Python 3.3 and 3.4, and dh_python3 could do its thing.

For Genshi, I wanted to use a debian/python3-genshi.pyremove file, which works
well, once I discovered a few inconveniences (see bug #741381).

Piotr recommends an override_dh_python3 rule which does the removal there
instead of the pyremove file.

I've documented the problem, and these options in the library style guide:

    https://wiki.debian.org/Python/LibraryStyleGuide

Cheers,
-Barry

Attachment: signature.asc
Description: PGP signature


Reply to: