Discussion:
Bug#997857: python-debian 0.1.42 broken with Python 3.5/3.6
(too old to reply)
Evgeni Golov
2021-10-26 07:40:02 UTC
Permalink
Package: python3-debian
Version: 0.1.42

Ohai,

filing this in Debian, as I am not aware of any other bugtracker for
python-debian, even tho the issue doesn't *really* affect Debian
unstable (as it doesn't have Python 3.5/3.6).

In python-debian 0.1.42, the following commit was made:
https://salsa.debian.org/python-debian-team/python-debian/-/commit/f31ee8f3f14892eb42c64fd8513f4cb2a0081d10

It essentially moves some code arround, but more explicitly, it puts the
typing code closer to the actual code. This is nice, but sadly breaks
usage of the real code on Python 3.5 and 3.6:

Python 3.6.15 (default, Sep 5 2021, 00:00:00)
[GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
from debian.deb822 import Deb822
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/python-debian/venv/lib64/python3.6/site-packages/debian/deb822.py", line 309, in <module>
from debian._util import (
File "/tmp/python-debian/venv/lib64/python3.6/site-packages/debian/_util.py", line 15, in <module>
"""
AttributeError: 'TypeVar' object attribute '__doc__' is read-only

The issue is that __doc__ of a TypeVar was read-only until 3.7.

You could probably try/except that assignment, or drop it completely, as
it doesn't *really* provide any meaningful documentation.

Or you could state the module doesn't support such an old Python, but
right now your setup.py states:

python_requires='>=3.3'

Thanks
Evgeni
Stuart Prescott
2021-11-02 14:30:03 UTC
Permalink
Thanks again Evgeni.

Looking at the problem and contemplating how we might address this, it is, of
course, quite simple to protect touching T.__doc__.

The test output for debfile.py / test_debfile.py shows there are many uses of
pathlib.Path that don't work until Python 3.6 (in particular, builtin open and
os.path functions). This can be addressed by sprinkling 15ish str() calls
through the code.

The output of shutil.make_archive also appears to not be reproducible in
Python 3.6 meaning that another test needs tweaking to not assume a file order
within the control.tar.gz file.

After these three sets of changes, the test suite passes with Python 3.5 from
stretch (at least for the non-RTS parser code:

python3 -m pytest --doctest-modules --verbose lib/ \
--ignore lib/debian/tests/test_repro_deb822.py \
--ignore lib/debian/_deb822_repro/

Given how simple these changes are, it is probably worth making them.
--
Stuart Prescott http://www.nanonanonano.net/ ***@nanonanonano.net
Debian Developer http://www.debian.org/ ***@debian.org
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7
Loading...