Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-python-debian for 
openSUSE:Factory checked in at 2025-09-30 17:42:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-debian (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-debian.new.11973 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-debian"

Tue Sep 30 17:42:51 2025 rev:6 rq:1308122 version:1.0.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-python-debian/python-python-debian.changes    
    2025-01-22 17:31:49.154978188 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-python-debian.new.11973/python-python-debian.changes
     2025-09-30 17:48:36.200965987 +0200
@@ -1,0 +2,11 @@
+Tue Sep 30 07:56:53 UTC 2025 - Dirk Müller <[email protected]>
+
+- update to 1.0.1:
+  * Fix handling of empty string data given to Deb822.iter_paragraphs.
+  * The 1.0.0 release of python-debian :)
+  * Upload to unstable (and release to pypi).
+  * Update typing imports to keep new mypy happy.
+  * Handle non-UTF-8 data in gpgv output from sequoia-generated data
+  * Permit filenames and Path objects in Deb822.iter_paragraphs()
+
+-------------------------------------------------------------------

Old:
----
  python-debian-0.1.52.tar.gz

New:
----
  python-debian-1.0.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-debian.spec ++++++
--- /var/tmp/diff_new_pack.XJSavw/_old  2025-09-30 17:48:38.621068191 +0200
+++ /var/tmp/diff_new_pack.XJSavw/_new  2025-09-30 17:48:38.645069205 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-python-debian
 #
-# Copyright (c) 2025 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
 # Copyright (c) 2017 Free Software Foundation Europe e.V.
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,7 +18,7 @@
 
 
 Name:           python-python-debian
-Version:        0.1.52
+Version:        1.0.1
 Release:        0
 Summary:        Debian package related modules
 License:        GPL-3.0-or-later

++++++ python-debian-0.1.52.tar.gz -> python-debian-1.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/.git_archival.txt 
new/python-debian-1.0.1/.git_archival.txt
--- old/python-debian-0.1.52/.git_archival.txt  2024-12-26 14:38:54.000000000 
+0100
+++ new/python-debian-1.0.1/.git_archival.txt   2025-03-11 13:24:11.000000000 
+0100
@@ -1,4 +1,4 @@
-node: db22904c3f23db8c3be3835c933f2d9955353ff1
-node-date: 2024-12-27T00:38:54+11:00
-describe-name: 0.1.52
-ref-names: HEAD -> master, tag: 0.1.52, 
refs/keep-around/db22904c3f23db8c3be3835c933f2d9955353ff1
+node: 287265c9bcb7218b38a76a1d3ac4645695d8f301
+node-date: 2025-03-11T23:24:11+11:00
+describe-name: 1.0.1
+ref-names: tag: 1.0.1, 
refs/keep-around/287265c9bcb7218b38a76a1d3ac4645695d8f301
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/README.rst 
new/python-debian-1.0.1/README.rst
--- old/python-debian-0.1.52/README.rst 2024-12-26 14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/README.rst  2025-03-11 13:24:11.000000000 +0100
@@ -5,14 +5,14 @@
 
 Currently supported are:
 
-  * Debtags information (:mod:`debian.debtags` module)
-  * debian/changelog (:mod:`debian.changelog` module)
-  * Packages files, pdiffs (:mod:`debian.debian_support` module)
+  * Debtags information (`debian.debtags` module)
+  * debian/changelog (`debian.changelog` module)
+  * Packages files, pdiffs (`debian.debian_support` module)
   * Control files of single or multiple RFC822-style paragraphs, e.g.
     debian/control, .changes, .dsc, Packages, Sources, Release, etc.
-    (:mod:`debian.deb822` module)
+    (`debian.deb822` module)
   * Raw .deb and .ar files, with (read-only) access to contained
-    files and meta-information (:mod:`debian.debfile` module)
+    files and meta-information (`debian.debfile` module)
 
 `API documentation`_, can be found online and throughout the code. There
 are examples both within the code and in the examples_ directory.
@@ -31,7 +31,7 @@
 interrogation of Debian specific data then consider adding it to this package.
 Please discuss your ideas on the `mailing list`_,
 make merge requests via the `salsa repository`_,
-and see the :ref:`Contributing` section of this documentation.
+and see the Contributing section of the documentation.
 
 .. _mailing list: mailto:[email protected]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/conftest.py 
new/python-debian-1.0.1/conftest.py
--- old/python-debian-0.1.52/conftest.py        2024-12-26 14:38:54.000000000 
+0100
+++ new/python-debian-1.0.1/conftest.py 2025-03-11 13:24:11.000000000 +0100
@@ -1,7 +1,4 @@
-try:
-    from typing import Dict, Any
-except ImportError:
-    pass
+from typing import Dict, Any
 
 import pytest
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/debian/changelog 
new/python-debian-1.0.1/debian/changelog
--- old/python-debian-0.1.52/debian/changelog   2024-12-26 14:38:54.000000000 
+0100
+++ new/python-debian-1.0.1/debian/changelog    2025-03-11 13:24:11.000000000 
+0100
@@ -1,3 +1,21 @@
+python-debian (1.0.1) unstable; urgency=medium
+
+  * Fix handling of empty string data given to Deb822.iter_paragraphs.
+
+ -- Stuart Prescott <[email protected]>  Tue, 11 Mar 2025 23:17:33 +1100
+
+python-debian (1.0.0) unstable; urgency=medium
+
+  * The 1.0.0 release of python-debian :)
+  * Upload to unstable (and release to pypi).
+  * Update typing imports to keep new mypy happy.
+  * Handle non-UTF-8 data in gpgv output from sequoia-generated data
+    (Closes: #1095835, #1087991).
+  * Permit filenames and Path objects in Deb822.iter_paragraphs()
+    (Closes: #1086512).
+
+ -- Stuart Prescott <[email protected]>  Mon, 10 Mar 2025 01:05:59 +1100
+
 python-debian (0.1.52) experimental; urgency=medium
 
   * Ensure that gpgv is not gpgv-from-sq for now.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/debian/rules 
new/python-debian-1.0.1/debian/rules
--- old/python-debian-0.1.52/debian/rules       2024-12-26 14:38:54.000000000 
+0100
+++ new/python-debian-1.0.1/debian/rules        2025-03-11 13:24:11.000000000 
+0100
@@ -35,7 +35,9 @@
        # needs python3-build python3-wheel
        rm -f dist/python?debian-$(SETUPTOOLS_SCM_PRETEND_VERSION)*
        python3 -m build --skip-dependency-check --no-isolation --sdist --wheel
-       echo "You can now: twine upload 
dist/python?debian-$(SETUPTOOLS_SCM_PRETEND_VERSION)*"
+       @echo "You can now:"
+       @echo "  twine check --strict 
dist/python?debian-$(SETUPTOOLS_SCM_PRETEND_VERSION)*"
+       @echo "  twine upload 
dist/python?debian-$(SETUPTOOLS_SCM_PRETEND_VERSION)*"
 
 apidoc:
        rm -f docs/api/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/docs/contributing.rst 
new/python-debian-1.0.1/docs/contributing.rst
--- old/python-debian-0.1.52/docs/contributing.rst      2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/docs/contributing.rst       2025-03-11 
13:24:11.000000000 +0100
@@ -206,6 +206,7 @@
 The upload procedure is::
 
     $ ./debian/rules dist
+    $ twine check --strict dist/python?debian-x.y.z.*
     $ twine upload dist/python?debian-x.y.z.*
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/_arch_table.py 
new/python-debian-1.0.1/src/debian/_arch_table.py
--- old/python-debian-0.1.52/src/debian/_arch_table.py  2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_arch_table.py   2025-03-11 
13:24:11.000000000 +0100
@@ -24,12 +24,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 import os
-
-try:
-    from typing import Iterable, Optional, IO, List, Dict, Union
-    from os import PathLike
-except ImportError:
-    pass
+from os import PathLike
+from typing import Iterable, Optional, IO, List, Dict, Union
 
 import collections.abc
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-debian-0.1.52/src/debian/_deb822_repro/_util.py 
new/python-debian-1.0.1/src/debian/_deb822_repro/_util.py
--- old/python-debian-0.1.52/src/debian/_deb822_repro/_util.py  2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_deb822_repro/_util.py   2025-03-11 
13:24:11.000000000 +0100
@@ -5,23 +5,17 @@
 import textwrap
 from abc import ABC
 
-try:
-    from typing import (
-        Optional, Union, Iterable, Callable, TYPE_CHECKING, Iterator,
-        Type, cast, List, Generic,
+from typing import (
+    Optional, Union, Iterable, Callable, TYPE_CHECKING, Iterator,
+    Type, cast, List, Generic,
 )
-    from debian._util import T
-    from debian._deb822_repro.types import TE, R, TokenOrElement
-
-    _combine_parts_ret_type = Callable[
-        [Iterable[Union[TokenOrElement, TE]]],
-        Iterable[Union[TokenOrElement, R]]
-    ]
-except ImportError:
-    # pylint: disable=unnecessary-lambda-assignment
-    TYPE_CHECKING = False
-    cast = lambda t, v: v
+from debian._util import T
+from debian._deb822_repro.types import TE, R, TokenOrElement
 
+_combine_parts_ret_type = Callable[
+    [Iterable[Union[TokenOrElement, TE]]],
+    Iterable[Union[TokenOrElement, R]]
+]
 
 if TYPE_CHECKING:
     from debian._deb822_repro.parsing import Deb822Element
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-debian-0.1.52/src/debian/_deb822_repro/formatter.py 
new/python-debian-1.0.1/src/debian/_deb822_repro/formatter.py
--- old/python-debian-0.1.52/src/debian/_deb822_repro/formatter.py      
2024-12-26 14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_deb822_repro/formatter.py       
2025-03-11 13:24:11.000000000 +0100
@@ -1,7 +1,17 @@
 import operator
+from typing import Iterator, Union
+
+try:
+    from typing_extensions import (
+        Literal,
+    )
+except ImportError:
+    pass
 
 from debian._deb822_repro._util import BufferingIterator
 from debian._deb822_repro.tokens import Deb822Token
+from debian._deb822_repro.types import TokenOrElement, FormatterCallback
+
 
 # Consider these "opaque" enum-like values.  The actual value was chosen to
 # make repr easier to implement, but they are subject to change.
@@ -9,12 +19,6 @@
 _CONTENT_TYPE_COMMENT = "is_comment"
 _CONTENT_TYPE_SEPARATOR = "is_separator"
 
-try:
-    from typing import Iterator, Union, Literal
-    from debian._deb822_repro.types import TokenOrElement, FormatterCallback
-except ImportError:
-    pass
-
 
 class FormatterContentToken(object):
     """Typed, tagged text for use with the formatting API
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-debian-0.1.52/src/debian/_deb822_repro/parsing.py 
new/python-debian-1.0.1/src/debian/_deb822_repro/parsing.py
--- old/python-debian-0.1.52/src/debian/_deb822_repro/parsing.py        
2024-12-26 14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_deb822_repro/parsing.py 2025-03-11 
13:24:11.000000000 +0100
@@ -7,6 +7,10 @@
 import weakref
 from abc import ABC
 from types import TracebackType
+from typing import (
+    Iterable, Iterator, List, Union, Dict, Optional, Callable, Any, Generic, 
Type, Tuple, IO,
+    cast, overload, Mapping, TYPE_CHECKING, Sequence,
+)
 from weakref import ReferenceType
 
 from debian._deb822_repro._util import (combine_into_replacement, 
BufferingIterator,
@@ -28,32 +32,17 @@
     resolve_ref, LinkedList, LinkedListNode, OrderedSet, _strI, 
default_field_sort_key,
 )
 
-try:
-    from typing import (
-        Iterable, Iterator, List, Union, Dict, Optional, Callable, Any, 
Generic, Type, Tuple, IO,
-        cast, overload, Mapping, TYPE_CHECKING, Sequence,
+from debian._util import T
+# for some reason, pylint does not see that Commentish is used in typing
+from debian._deb822_repro.types import (  # pylint: disable=unused-import
+    ST, VE, TE,
+    ParagraphKey, TokenOrElement, Commentish, ParagraphKeyBase,
+    FormatterCallback,
 )
-    from debian._util import T
-    # for some reason, pylint does not see that Commentish is used in typing
-    from debian._deb822_repro.types import (  # pylint: disable=unused-import
-        ST, VE, TE,
-        ParagraphKey, TokenOrElement, Commentish, ParagraphKeyBase,
-        FormatterCallback,
-    )
 
-    if TYPE_CHECKING:
-        StreamingValueParser = Callable[[Deb822Token, 
BufferingIterator[Deb822Token]], VE]
-        StrToValueParser = Callable[[str], Iterable[Union['Deb822Token', VE]]]
-        KVPNode = LinkedListNode['Deb822KeyValuePairElement']
-    else:
-        StreamingValueParser = None
-        StrToValueParser = None
-        KVPNode = None
-except ImportError:
-    if not TYPE_CHECKING:
-        # pylint: disable=unnecessary-lambda-assignment
-        cast = lambda t, v: v
-        overload = lambda f: None
+StreamingValueParser = Callable[[Deb822Token, BufferingIterator[Deb822Token]], 
VE]
+StrToValueParser = Callable[[str], Iterable[Union['Deb822Token', VE]]]
+KVPNode = LinkedListNode['Deb822KeyValuePairElement']
 
 
 class ValueReference(Generic[TE]):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-debian-0.1.52/src/debian/_deb822_repro/tokens.py 
new/python-debian-1.0.1/src/debian/_deb822_repro/tokens.py
--- old/python-debian-0.1.52/src/debian/_deb822_repro/tokens.py 2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_deb822_repro/tokens.py  2025-03-11 
13:24:11.000000000 +0100
@@ -1,5 +1,6 @@
 import re
 import sys
+from typing import Optional, cast, TYPE_CHECKING, Iterable, Union, Dict, 
Callable
 import weakref
 from weakref import ReferenceType
 
@@ -8,12 +9,6 @@
     Range, ONE_CHAR_RANGE, ONE_LINE_RANGE, Position
 from debian._util import resolve_ref, _strI
 
-try:
-    from typing import Optional, cast, TYPE_CHECKING, Iterable, Union, Dict, 
Callable
-except ImportError:
-    # pylint: disable=unnecessary-lambda-assignment
-    TYPE_CHECKING = False
-    cast = lambda t, v: v
 
 if TYPE_CHECKING:
     from debian._deb822_repro.parsing import Deb822Element
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/_util.py 
new/python-debian-1.0.1/src/debian/_util.py
--- old/python-debian-0.1.52/src/debian/_util.py        2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/_util.py 2025-03-11 13:24:11.000000000 
+0100
@@ -1,18 +1,14 @@
 import weakref
 from weakref import ReferenceType
 
-try:
-    from typing import (
-        Iterable, Optional, Generic, Dict, Iterator, TypeVar, TYPE_CHECKING, 
Any,
-        Callable,
-    )
+from typing import (
+    Iterable, Optional, Generic, Dict, Iterator, TypeVar, TYPE_CHECKING, Any,
+    Callable,
+)
 
-    # Used a generic type for any case where we need a generic type without 
any bounds
-    # (e.g. for the LinkedList interface and some super-classes/mixins).
-    T = TypeVar('T')
-
-except ImportError:  # pragma: no cover
-    TYPE_CHECKING = False
+# Used a generic type for any case where we need a generic type without any 
bounds
+# (e.g. for the LinkedList interface and some super-classes/mixins).
+T = TypeVar('T')
 
 
 def resolve_ref(ref):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/arfile.py 
new/python-debian-1.0.1/src/debian/arfile.py
--- old/python-debian-0.1.52/src/debian/arfile.py       2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/arfile.py        2025-03-11 
13:24:11.000000000 +0100
@@ -25,23 +25,16 @@
 from pathlib import Path
 import sys
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        BinaryIO,
-        Dict,
-        Generator,
-        IO,
-        Iterator,
-        List,
-        NoReturn,
-        Optional,
-        Union,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    pass
+from typing import (
+    BinaryIO,
+    Dict,
+    Generator,
+    Iterator,
+    List,
+    NoReturn,
+    Optional,
+    Union,
+)
 
 
 GLOBAL_HEADER = b"!<arch>\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/changelog.py 
new/python-debian-1.0.1/src/debian/changelog.py
--- old/python-debian-0.1.52/src/debian/changelog.py    2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/changelog.py     2025-03-11 
13:24:11.000000000 +0100
@@ -103,43 +103,36 @@
 import re
 import socket
 
+from typing import (
+    Dict,
+    Iterable,
+    Iterator,
+    IO,
+    List,
+    Optional,
+    Pattern,
+    Union,
+    Text,
+    Tuple,
+)
+
 # pwd is only available on Unix platforms.
 try:
     import pwd
 except ImportError:
     pass
 
-
-try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Any,
-        Dict,
-        Iterable,
-        Iterator,
-        IO,
-        List,
-        Optional,
-        Pattern,
-        Union,
-        Text,
-        Tuple,
-        TypeVar,
-    )
-    IterableDataSource = Union[
-        bytes,
-        Text,
-        IO[Text],
-        Iterable[Text],
-        Iterable[bytes],
-    ]
-except ImportError:
-    # Missing types aren't important at runtime
-    pass
-
 from debian.debian_support import Version
 
 
+IterableDataSource = Union[
+    bytes,
+    Text,
+    IO[Text],
+    Iterable[Text],
+    Iterable[bytes],
+]
+
 logger = logging.getLogger('debian.changelog')
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/copyright.py 
new/python-debian-1.0.1/src/debian/copyright.py
--- old/python-debian-0.1.52/src/debian/copyright.py    2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/copyright.py     2025-03-11 
13:24:11.000000000 +0100
@@ -32,30 +32,21 @@
 import io
 import re
 
-try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Any,
-        Callable,
-        FrozenSet,
-        IO,
-        Iterable,
-        Iterator,
-        List,
-        Optional,
-        Pattern,
-        Text,
-        Tuple,
-        Union,
-        TYPE_CHECKING, cast,
+from typing import (
+    Any,
+    FrozenSet,
+    IO,
+    Iterable,
+    Iterator,
+    List,
+    Optional,
+    Pattern,
+    Text,
+    Tuple,
+    Union,
+    cast,
 )
 
-    ParagraphTypes = Union["FilesParagraph", "LicenseParagraph"]
-    AllParagraphTypes = Union["Header", "FilesParagraph", "LicenseParagraph"]
-except ImportError:
-    # Lack of typing is not important at runtime
-    TYPE_CHECKING = False
-
 from debian._deb822_repro import (
     parse_deb822_file,
     Deb822ParagraphElement,
@@ -70,6 +61,11 @@
 except ImportError:
     pass
 
+
+ParagraphTypes = Union["FilesParagraph", "LicenseParagraph"]
+AllParagraphTypes = Union["Header", "FilesParagraph", "LicenseParagraph"]
+
+
 _CURRENT_FORMAT = (
     'https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/deb822.py 
new/python-debian-1.0.1/src/debian/deb822.py
--- old/python-debian-0.1.52/src/debian/deb822.py       2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/deb822.py        2025-03-11 
13:24:11.000000000 +0100
@@ -120,8 +120,10 @@
 =====
 
 Deb822 objects are normally initialized from a file object (from which
-at most one paragraph is read) or a string. Alternatively, any sequence
-that returns one line of input at a time may be used, e.g a list of strings.
+at most one paragraph is read), a multiline string of Deb822 format, a
+string representing a filename, or a pathlib.Path object.
+Alternatively, any sequence that returns one line of input at a time
+may be used, e.g a list of strings.
 
 PGP signatures, if present, will be stripped.
 
@@ -230,82 +232,48 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
 
+import builtins    # pylint: disable=unused-import
 import collections.abc
 import datetime
 import email.utils
 import functools
 import logging
 import io
+from pathlib import Path
 import re
 import subprocess
+from typing import (
+    Any,
+    Callable,
+    cast,
+    Dict,
+    Generator,
+    Iterator,
+    Iterable,
+    IO,
+    List,
+    Mapping,
+    MutableMapping,
+    Optional,
+    overload,
+    Text,
+    Tuple,
+    Type,
+    TypeVar,
+    Union,
+    TYPE_CHECKING,
+)
 import warnings
 
-
 try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Any,
-        Callable,
-        cast,
-        Dict,
-        FrozenSet,
-        Generator,
-        Iterator,
-        Iterable,
-        IO,
-        List,
-        Mapping,
-        MutableMapping,
-        Optional,
-        overload,
-        #Pattern,
-        Protocol,
-        Set,
-        Text,
-        Tuple,
-        Type,
-        TypeVar,
-        Union,
-        TYPE_CHECKING,
-    )
-    IterableInputDataType = Union[
-        IO[Text],
-        IO[bytes],
-        Iterable[Text],
-        Iterable[bytes],
-    ]
-    InputDataType = Union[
-        bytes,
-        Text,
-        IterableInputDataType,
-    ]
-
-    Deb822ValueType = Any    # this really is Union[str, List] but that is a 
can of worms
-    Deb822Mapping = Mapping[str, Deb822ValueType]
-    Deb822MutableMapping = MutableMapping[str, Deb822ValueType]
-    import builtins    # pylint: disable=unused-import
-    T_Deb822Dict = TypeVar('T_Deb822Dict', bound='Deb822Dict')
-
     from typing_extensions import (
         Literal,
+        Protocol,
         TypedDict,
     )
 except ImportError:
-    # Lack of typing is not important at runtime
-    TYPE_CHECKING = False
+    pass
 
-    # Fake some definitions
-    if not TYPE_CHECKING:
-        # this block also hides the definitions from mypy
-        # pylint: disable=unnecessary-lambda-assignment
-        overload = lambda f: None
-        cast = lambda t, v: v
-        IO = {
-            bytes: None,
-            str: None,
-        }
-        Deb822Mapping = None
-        InputDataType = None
 
 # We re-export OrderedSet in case someone used it externally.  The others look
 # sufficiently internal that we do not bother with backwards compatibility.
@@ -319,6 +287,23 @@
 import debian.changelog
 
 
+IterableInputDataType = Union[
+    IO[Text],
+    IO[bytes],
+    Iterable[Text],
+    Iterable[bytes],
+]
+InputDataType = Union[
+    bytes,
+    Text,
+    IterableInputDataType,
+]
+
+Deb822ValueType = Any    # this really is Union[str, List] but that is a can 
of worms
+Deb822Mapping = Mapping[str, Deb822ValueType]
+Deb822MutableMapping = MutableMapping[str, Deb822ValueType]
+T_Deb822Dict = TypeVar('T_Deb822Dict', bound='Deb822Dict')
+
 try:
     import apt_pkg
     # This module uses apt_pkg only for its TagFile interface.
@@ -609,7 +594,8 @@
     """ Generic Deb822 data
 
     :param sequence: a string, or any object that returns a line of
-        input each time, normally a file.  Alternately, sequence can
+        input each time, normally a file.  Or a filename (as a str) or a
+        `pathlib.Path` object. Alternately, sequence can
         be a dict that contains the initial key-value pairs. When
         python-apt is present, sequence can also be a compressed object,
         for example a file object associated to something.gz.
@@ -653,7 +639,7 @@
     """
 
     def __init__(self,
-                 sequence=None,     # type: Optional[Union[InputDataType, 
Deb822Mapping]]
+                 sequence=None,     # type: Optional[Union[InputDataType, 
Deb822Mapping, Path]]
                  fields=None,       # type: Optional[List[str]]
                  _parsed=None,      # type: Optional[Union[Deb822, 
TagSectionWrapper]]
                  encoding="utf-8",  # type: str
@@ -685,7 +671,7 @@
 
     @classmethod
     def iter_paragraphs(cls,                     # type: Type[T_Deb822]
-                        sequence,                # type: InputDataType
+                        sequence,                # type: Union[InputDataType, 
Path]
                         fields=None,             # type: Optional[List[str]]
                         use_apt_pkg=False,       # type: bool
                         shared_storage=False,    # type: bool
@@ -717,7 +703,15 @@
         """
         # pylint: disable=unused-argument
 
-        apt_pkg_allowed = use_apt_pkg and _has_fileno(sequence)
+        is_filename_like = (
+            isinstance(sequence, Path) or
+            (isinstance(sequence, str) and sequence and "\n" not in sequence 
and
+             Path(sequence).exists() and Path(sequence).is_file())
+        )
+
+        apt_pkg_allowed = use_apt_pkg and (
+            _has_fileno(sequence) or is_filename_like
+        )
 
         if use_apt_pkg and not _have_apt_pkg:
             # warn that apt_pkg was requested but not installed
@@ -738,6 +732,8 @@
 
         if _have_apt_pkg and apt_pkg_allowed:
             # pylint: disable=no-member
+            if isinstance(sequence, Path):
+                sequence = str(sequence)
             parser = apt_pkg.TagFile(sequence, bytes=True)
             for section in parser:
                 paragraph = cls(fields=fields,
@@ -750,18 +746,28 @@
             # Split this into multiple conditionals so that type checking
             # can follow the types through
             iterable = [] # type: IterableInputDataType
-            if isinstance(sequence, str):
-                iterable = iter(sequence.splitlines())
-            elif isinstance(sequence, bytes):
-                iterable = iter(sequence.splitlines())
-            else:
-                # StringIO/list can be iterated directly
-                iterable = iter(sequence)  # type: ignore
-            while True:
-                x = cls(iterable, fields, encoding=encoding, strict=strict)
-                if not x:
-                    break
-                yield x
+            close_fh = False
+            try:
+                if is_filename_like:
+                    # pylint: disable=consider-using-with
+                    assert isinstance(sequence, (str, Path))
+                    iterable = iter(open(sequence, "rt", encoding=encoding))
+                    close_fh = True
+                elif isinstance(sequence, str):
+                    iterable = iter(sequence.splitlines())
+                elif isinstance(sequence, bytes):  # repetition for mypy
+                    iterable = iter(sequence.splitlines())
+                else:
+                    # StringIO/list can be iterated directly
+                    iterable = iter(sequence)  # type: ignore
+                while True:
+                    x = cls(iterable, fields, encoding=encoding, strict=strict)
+                    if not x:
+                        break
+                    yield x
+            finally:
+                if close_fh:
+                    iterable.close()   # type: ignore
 
     ###
 
@@ -1355,8 +1361,8 @@
                 inp = cls._get_full_bytes(sequence)
             out, err = p.communicate(inp)
 
-        return cls.from_output(out.decode('utf-8'),
-                               err.decode('utf-8'))
+        return cls.from_output(out.decode('unicode-escape'),
+                               err.decode('unicode-escape'))
 
     @staticmethod
     def _get_full_bytes(sequence):
@@ -2292,7 +2298,7 @@
 
     @classmethod
     def iter_paragraphs(cls,
-                        sequence,                # type: InputDataType
+                        sequence,                # type: Union[InputDataType, 
Path]
                         fields=None,             # type: Optional[List[str]]
                         use_apt_pkg=True,        # type: bool
                         shared_storage=False,    # type: bool
@@ -2334,7 +2340,7 @@
 
     @classmethod
     def iter_paragraphs(cls,
-                        sequence,              # type: InputDataType
+                        sequence,              # type: Union[InputDataType, 
Path]
                         fields=None,           # type: Optional[List[str]]
                         use_apt_pkg=True,      # type: bool
                         shared_storage=False,  # type: bool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/debfile.py 
new/python-debian-1.0.1/src/debian/debfile.py
--- old/python-debian-0.1.52/src/debian/debfile.py      2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/debfile.py       2025-03-11 
13:24:11.000000000 +0100
@@ -29,34 +29,24 @@
 import os.path
 from pathlib import Path
 
+from typing import (
+    Any,
+    BinaryIO,
+    Dict,
+    IO,
+    Iterator,
+    List,
+    Optional,
+    Text,
+    Union,
+    overload,
+)
 try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Any,
-        BinaryIO,
-        Dict,
-        IO,
-        Iterator,
-        List,
-        Optional,
-        Text,
-        TypeVar,
-        Union,
-        overload,
-        TYPE_CHECKING,
-    )
     from typing_extensions import (
         Literal,
     )
 except ImportError:
-    # Missing types aren't important at runtime
-    TYPE_CHECKING = False
-
-    if not TYPE_CHECKING:
-        # this block also hides the definition from mypy
-        # pylint: disable=unnecessary-lambda-assignment
-        overload = lambda f: None
-
+    pass
 
 from debian.arfile import ArFile, ArError, ArMember     # pylint: 
disable=unused-import
 from debian.changelog import Changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/debian_support.py 
new/python-debian-1.0.1/src/debian/debian_support.py
--- old/python-debian-0.1.52/src/debian/debian_support.py       2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/debian_support.py        2025-03-11 
13:24:11.000000000 +0100
@@ -22,29 +22,24 @@
 import os.path
 import re
 
-try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Any,
-        AnyStr,
-        BinaryIO,
-        Dict,
-        Iterable,
-        Iterator,
-        Generator,
-        List,
-        Match,
-        NoReturn,
-        Optional,
-        Pattern,
-        Text,
-        TextIO,
-        Tuple,
-        Union,
-    )
-except ImportError:
-    # Lack of typing is not important at runtime
-    pass
+from typing import (
+    Any,
+    AnyStr,
+    BinaryIO,
+    Dict,
+    Iterable,
+    Iterator,
+    Generator,
+    List,
+    Match,
+    NoReturn,
+    Optional,
+    Pattern,
+    Text,
+    TextIO,
+    Tuple,
+    Union,
+)
 
 try:
     import apt_pkg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/debtags.py 
new/python-debian-1.0.1/src/debian/debtags.py
--- old/python-debian-0.1.52/src/debian/debtags.py      2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/debtags.py       2025-03-11 
13:24:11.000000000 +0100
@@ -21,28 +21,23 @@
 import pickle
 import re
 
-try:
-    # pylint: disable=unused-import,deprecated-class
-    from typing import (
-        Callable,
-        Dict,
-        IO,
-        Iterable,
-        Iterator,
-        List,
-        Optional,
-        Set,
-        Text,
-        Tuple,
-    )
-    PkgTagDbType = Dict[str, Set[str]]
-    TagPkgDbType = Dict[str, Set[str]]
-    PkgFilterType = Callable[[Text], bool]
-    TagFilterType = Callable[[Text], bool]
-    PkgTagFilterType = Callable[[Tuple[Text, Set[Text]]], bool]
-except ImportError:
-    # Lack of typing is not important at runtime
-    pass
+from typing import (
+    Callable,
+    Dict,
+    IO,
+    Iterable,
+    Iterator,
+    List,
+    Optional,
+    Set,
+    Text,
+    Tuple,
+)
+PkgTagDbType = Dict[str, Set[str]]
+TagPkgDbType = Dict[str, Set[str]]
+PkgFilterType = Callable[[Text], bool]
+TagFilterType = Callable[[Text], bool]
+PkgTagFilterType = Callable[[Tuple[Text, Set[Text]]], bool]
 
 
 def parse_tags(input_data):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/src/debian/watch.py 
new/python-debian-1.0.1/src/debian/watch.py
--- old/python-debian-0.1.52/src/debian/watch.py        2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/src/debian/watch.py 2025-03-11 13:24:11.000000000 
+0100
@@ -20,20 +20,14 @@
 import logging
 import re
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Iterable,
-        Iterator,
-        List,
-        Optional,
-        Sequence,
-        TextIO,
-        Tuple,
-        )
-except ImportError:
-    # Lack of typing is not important at runtime
-    pass
+from typing import (
+    Iterable,
+    Iterator,
+    List,
+    Optional,
+    Sequence,
+    TextIO,
+)
 
 # The default watch file version to use for new files.
 DEFAULT_VERSION = 4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/stubbed_arch_table.py 
new/python-debian-1.0.1/tests/stubbed_arch_table.py
--- old/python-debian-0.1.52/tests/stubbed_arch_table.py        2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/stubbed_arch_table.py 2025-03-11 
13:24:11.000000000 +0100
@@ -1,9 +1,6 @@
 from io import StringIO
-try:
-    from os import PathLike
-    from typing import Union
-except ImportError:
-    pass
+from os import PathLike
+from typing import Union
 
 from debian._arch_table import DpkgArchTable
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_changelog.py 
new/python-debian-1.0.1/tests/test_changelog.py
--- old/python-debian-0.1.52/tests/test_changelog.py    2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_changelog.py     2025-03-11 
13:24:11.000000000 +0100
@@ -26,6 +26,12 @@
 
 import logging
 import os.path
+from typing import (
+    Any,
+    IO,
+    Optional,
+    Text,
+)
 
 import pytest
 
@@ -33,18 +39,6 @@
 from debian import debian_support
 
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        IO,
-        Optional,
-        Text,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    pass
-
 
 def find_test_file(filename):
     # type: (str) -> str
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_copyright.py 
new/python-debian-1.0.1/tests/test_copyright.py
--- old/python-debian-0.1.52/tests/test_copyright.py    2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_copyright.py     2025-03-11 
13:24:11.000000000 +0100
@@ -28,21 +28,16 @@
 from debian._deb822_repro import parse_deb822_file, Deb822ParagraphElement
 
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        Generator,
-        List,
-        Pattern,
-        Sequence,
-        Text,
-        no_type_check,
-        TYPE_CHECKING,
-    )
-except ImportError:
-    # Lack of typing is not important at runtime
-    TYPE_CHECKING = False
+from typing import (
+    Any,
+    Generator,
+    List,
+    Pattern,
+    Sequence,
+    Text,
+    no_type_check,
+    TYPE_CHECKING,
+)
 
 
 SIMPLE = """\
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_deb822.py 
new/python-debian-1.0.1/tests/test_deb822.py
--- old/python-debian-0.1.52/tests/test_deb822.py       2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_deb822.py        2025-03-11 
13:24:11.000000000 +0100
@@ -23,6 +23,7 @@
 import logging
 import os
 import os.path
+from pathlib import Path
 import pickle
 import re
 import shutil
@@ -59,29 +60,20 @@
 from debian.debian_support import Version
 
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        Callable,
-        Dict,
-        Generator,
-        IO,
-        List,
-        Optional,
-        Union,
-        Text,
-        Tuple,
-        Type,
-        TypeVar,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    TYPE_CHECKING = False
-
-    # Fake some definitions
-    if not TYPE_CHECKING:
-        TypeVar = lambda t: None
+from typing import (
+    Any,
+    Callable,
+    Dict,
+    Generator,
+    IO,
+    List,
+    Optional,
+    Union,
+    Text,
+    Tuple,
+    Type,
+    TypeVar,
+)
 
 
 # Only run tests that rely on the gpgv signature validation executable if
@@ -704,6 +696,30 @@
         for d in deb822.Deb822.iter_paragraphs(binary):
             self.assertWellParsed(d, PARSED_PACKAGE)
 
+    @pytest.mark.skipif(not _have_apt_pkg, reason="apt_pkg is not available")
+    def test_iter_paragraphs_filename_apt_pkg(self, tmp_path: Path) -> None:
+        self._test_iter_paragraphs_filename(tmp_path, True)
+
+    def test_iter_paragraphs_filename_no_apt_pkg(self, tmp_path: Path) -> None:
+        self._test_iter_paragraphs_filename(tmp_path, False)
+
+    def _test_iter_paragraphs_filename(self, tmp_path: Path, use_apt_pkg: 
bool) -> None:
+        text = (UNPARSED_PACKAGE + '\n\n\n' + UNPARSED_PACKAGE)
+        tmp = tmp_path / "Packages"
+
+        with open(tmp, "wt", encoding="UTF-8") as fh:
+            fh.write(text)
+
+        for d in deb822.Deb822.iter_paragraphs(tmp, use_apt_pkg=use_apt_pkg):
+            self.assertWellParsed(d, PARSED_PACKAGE)
+
+        assert len(list(deb822.Deb822.iter_paragraphs(tmp, 
use_apt_pkg=use_apt_pkg))) == 2
+
+        for d in deb822.Deb822.iter_paragraphs(str(tmp), 
use_apt_pkg=use_apt_pkg):
+            self.assertWellParsed(d, PARSED_PACKAGE)
+
+        assert len(list(deb822.Deb822.iter_paragraphs(str(tmp), 
use_apt_pkg=use_apt_pkg))) == 2
+
     def _test_iter_paragraphs_count(self, filename, cmd, expected, *args, 
**kwargs):
         # type: (str, Callable[..., Any], int, *Any, **Any) -> None
         with open_utf8(filename) as fh:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_debfile.py 
new/python-debian-1.0.1/tests/test_debfile.py
--- old/python-debian-0.1.52/tests/test_debfile.py      2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_debfile.py       2025-03-11 
13:24:11.000000000 +0100
@@ -36,30 +36,22 @@
 from debian import debfile
 
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        Callable,
-        Dict,
-        Generator,
-        IO,
-        Iterator,
-        List,
-        Optional,
-        Union,
-        Text,
-        Tuple,
-        Type,
-        TypeVar,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    TYPE_CHECKING = False
+from typing import (
+    Any,
+    Callable,
+    Dict,
+    Generator,
+    IO,
+    Iterator,
+    List,
+    Optional,
+    Union,
+    Text,
+    Tuple,
+    Type,
+    TypeVar,
+)
 
-    # Fake some definitions
-    if not TYPE_CHECKING:
-        TypeVar = lambda t: None
 
 
 # Only run tests that rely on ar to make archives if it installed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_debian_support.py 
new/python-debian-1.0.1/tests/test_debian_support.py
--- old/python-debian-0.1.52/tests/test_debian_support.py       2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_debian_support.py        2025-03-11 
13:24:11.000000000 +0100
@@ -25,6 +25,11 @@
 import re
 import sys
 import tempfile
+from typing import (
+    Any,
+    List,
+    Optional,
+)
 import urllib.parse
 
 import pytest
@@ -33,18 +38,6 @@
 from debian.debian_support import *
 
 
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Any,
-        List,
-        Optional,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    pass
-
-
 def find_test_file(filename: str) -> str:
     """ find a test file that is located within the test suite """
     return os.path.abspath(os.path.join(os.path.dirname(__file__), filename))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_repro_deb822.py 
new/python-debian-1.0.1/tests/test_repro_deb822.py
--- old/python-debian-0.1.52/tests/test_repro_deb822.py 2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_repro_deb822.py  2025-03-11 
13:24:11.000000000 +0100
@@ -38,11 +38,9 @@
 from debian._deb822_repro.tokens import Deb822ErrorToken
 from debian.deb822 import Deb822
 
-try:
-    from typing import Any, Iterator, Tuple, Optional
-    from debian._deb822_repro.types import VE, ST
-except ImportError:
-    pass
+from typing import Any, Iterator, Tuple, Optional
+from debian._deb822_repro.types import VE, ST
+
 
 RoundTripParseCase = collections.namedtuple('RoundTripParseCase',
                                             ['input',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-debian-0.1.52/tests/test_watch.py 
new/python-debian-1.0.1/tests/test_watch.py
--- old/python-debian-0.1.52/tests/test_watch.py        2024-12-26 
14:38:54.000000000 +0100
+++ new/python-debian-1.0.1/tests/test_watch.py 2025-03-11 13:24:11.000000000 
+0100
@@ -17,27 +17,13 @@
 
 """Tests for debian.watch."""
 
-import pytest
-
-try:
-    from StringIO import StringIO  # type: ignore
-except ImportError:
-    from io import StringIO
-
-try:
-    # pylint: disable=unused-import
-    from typing import (
-        Optional,
-        TypeVar,
-    )
-except ImportError:
-    # Missing types aren't important at runtime
-    TYPE_CHECKING = False
-
-    # Fake some definitions
-    if not TYPE_CHECKING:
-        TypeVar = lambda t: None
+from io import StringIO
+from typing import (
+    Optional,
+    TypeVar,
+)
 
+import pytest
 
 from debian.watch import (
     expand,

Reply via email to