Bug#1017836: python-debian: Copyright doesn't throw NotMachineReadableError anymore

Baptiste Beauplat lyknode at debian.org
Sun Aug 21 11:45:46 BST 2022


Source: python-debian
Version: 0.1.46
Severity: normal

Dear Maintainer,

When passing a non-dep5 copyright file to Copyright, it use to throw
NotMachineReadableError, which is quite useful to categorise the file as
such. It doesn't do that anymore, throwing instead a generic ValueError.

To reproduce:

$ curl -SLO https://sources.debian.org/data/main/h/hello/2.10-2/debian/copyright
$ python3  -c "from debian.copyright import Copyright; Copyright(open('copyright'))"

With python3-debian from bullseye:

```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/debian/copyright.py", line 155, in __init__
    raise NotMachineReadableError('no paragraphs in input')
```

With python3-debian from unstable and testing:

```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/debian/copyright.py", line 165, in __init__
    self.__file = parse_deb822_file(sequence=sequence, encoding=encoding)
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 3091, in parse_deb822_file
    deb822_file = Deb822FileElement(LinkedList(tokens))
  File "/usr/lib/python3/dist-packages/debian/_util.py", line 159, in __init__
    self.extend(values)
  File "/usr/lib/python3/dist-packages/debian/_util.py", line 272, in extend
    for v in values:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 103, in _impl
    for token in token_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 103, in _impl
    for token in token_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 2968, in _build_field_with_value
    for token_or_element in buffered_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 142, in __next__
    return next(self._stream)
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 103, in _impl
    for token in token_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 2904, in _build_value_line
    for token in buffered_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 142, in __next__
    return next(self._stream)
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 103, in _impl
    for token in token_stream:
  File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 3027, in _abort_on_error_tokens
    raise ValueError('Syntax or Parse error on the line: "{error_as_text}"'.format(
ValueError: Syntax or Parse error on the line: "This is the Debian GNU prepackaged version of the FSF's GNU hello\n"
```

Best,

-- 
Baptiste Beauplat - lyknode
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-python-debian-maint/attachments/20220821/3335f792/attachment.sig>


More information about the pkg-python-debian-maint mailing list