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 2022-12-04 14:58:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-debian (Old) and /work/SRC/openSUSE:Factory/.python-python-debian.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-debian" Sun Dec 4 14:58:47 2022 rev:4 rq:1039903 version:0.1.49 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-debian/python-python-debian.changes 2022-10-31 12:15:20.238395221 +0100 +++ /work/SRC/openSUSE:Factory/.python-python-debian.new.1835/python-python-debian.changes 2022-12-04 14:59:17.992597105 +0100 @@ -1,0 +2,13 @@ +Sat Dec 3 21:28:19 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.1.49 + * Fix whitespace handling of Copyright files (Closes: #960278) + * Make python-debian (more) portable (Closes: #1011937) + - Tweak tests to be portable to other platforms + - Adapt tests so that skipping optional tests can be prevented if needed + - Add other platforms to CI to test portability + * Switch tests to use more pytest features. + * Updates for newer mypy and pylint. + * Add Debian 14 'forky' to the list of known releases. + +------------------------------------------------------------------- Old: ---- python-debian-0.1.48.tar.gz New: ---- python-debian-0.1.49.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-debian.spec ++++++ --- /var/tmp/diff_new_pack.lBttdP/_old 2022-12-04 14:59:18.488599963 +0100 +++ /var/tmp/diff_new_pack.lBttdP/_new 2022-12-04 14:59:18.492599986 +0100 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-python-debian -Version: 0.1.48 +Version: 0.1.49 Release: 0 Summary: Debian package related modules License: GPL-3.0-or-later ++++++ python-debian-0.1.48.tar.gz -> python-debian-0.1.49.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/PKG-INFO new/python-debian-0.1.49/PKG-INFO --- old/python-debian-0.1.48/PKG-INFO 2022-10-15 07:04:02.387403700 +0200 +++ new/python-debian-0.1.49/PKG-INFO 2022-11-20 01:43:21.422022000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: python-debian -Version: 0.1.48 +Version: 0.1.49 Summary: Debian package related modules Home-page: https://salsa.debian.org/python-debian-team/python-debian Maintainer: Debian python-debian Maintainers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/_deb822_repro/__init__.py new/python-debian-0.1.49/lib/debian/_deb822_repro/__init__.py --- old/python-debian-0.1.48/lib/debian/_deb822_repro/__init__.py 2022-09-11 03:35:03.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/_deb822_repro/__init__.py 2022-10-31 15:38:00.000000000 +0100 @@ -93,14 +93,14 @@ ... more deskription with a misspelling ... '''.lstrip() # To remove the leading newline >>> # A few definitions to emulate file I/O (would be different in the program) - >>> import contextlib + >>> import contextlib, os >>> @contextlib.contextmanager ... def open_input(): ... # Works with and without keepends=True. ... # Keep the ends here to truly emulate an open file. ... yield dctrl_input.splitlines(keepends=True) >>> def open_output(): - ... return open('/dev/null', 'wb') + ... return open(os.devnull, 'wb') With debian.deb822, your code might look like this:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/_deb822_repro/_util.py new/python-debian-0.1.49/lib/debian/_deb822_repro/_util.py --- old/python-debian-0.1.48/lib/debian/_deb822_repro/_util.py 2022-09-11 03:35:03.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/_deb822_repro/_util.py 2022-10-16 07:54:15.000000000 +0200 @@ -18,6 +18,7 @@ Iterable[Union[TokenOrElement, R]] ] except ImportError: + # pylint: disable=unnecessary-lambda-assignment TYPE_CHECKING = False cast = lambda t, v: v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/_deb822_repro/parsing.py new/python-debian-0.1.49/lib/debian/_deb822_repro/parsing.py --- old/python-debian-0.1.48/lib/debian/_deb822_repro/parsing.py 2022-10-15 07:03:08.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/_deb822_repro/parsing.py 2022-10-16 07:54:15.000000000 +0200 @@ -49,6 +49,7 @@ KVPNode = None except ImportError: if not TYPE_CHECKING: + # pylint: disable=unnecessary-lambda-assignment cast = lambda t, v: v overload = lambda f: None @@ -1467,9 +1468,9 @@ ) def _interpret_value(self, key, value): - # type: (ParagraphKey, Deb822KeyValuePairElement) -> T + # type: (ParagraphKey, Deb822KeyValuePairElement) -> str # mypy is a bit dense and cannot see that T == str - return cast('T', self._convert_value_to_str(value)) + return self._convert_value_to_str(value) class AbstractDeb822ParagraphWrapper(AutoResolvingMixin[T], ABC): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/_deb822_repro/tokens.py new/python-debian-0.1.49/lib/debian/_deb822_repro/tokens.py --- old/python-debian-0.1.48/lib/debian/_deb822_repro/tokens.py 2022-09-11 03:34:50.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/_deb822_repro/tokens.py 2022-10-16 07:54:15.000000000 +0200 @@ -9,6 +9,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/_version.py new/python-debian-0.1.49/lib/debian/_version.py --- old/python-debian-0.1.48/lib/debian/_version.py 2022-10-15 07:04:00.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/_version.py 2022-11-20 01:43:20.000000000 +0100 @@ -1,3 +1,3 @@ """ Version of the package """ -__version__ = '0.1.48' +__version__ = '0.1.49' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/arfile.py new/python-debian-0.1.49/lib/debian/arfile.py --- old/python-debian-0.1.48/lib/debian/arfile.py 2022-05-29 16:42:49.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/arfile.py 2022-10-16 07:54:15.000000000 +0200 @@ -377,7 +377,6 @@ def seekable(self): # type: () -> bool - # pylint: disable=no-self-use return True def close(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/changelog.py new/python-debian-0.1.49/lib/debian/changelog.py --- old/python-debian-0.1.48/lib/debian/changelog.py 2022-09-11 03:34:50.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/changelog.py 2022-10-31 15:38:00.000000000 +0100 @@ -50,7 +50,7 @@ >>> import gzip >>> from debian.changelog import Changelog - >>> with gzip.open('/usr/share/doc/dpkg/changelog.Debian.gz') as fh: + >>> with gzip.open('/usr/share/doc/dpkg/changelog.Debian.gz') as fh: # doctest: +SKIP ... ch = Changelog(fh, max_blocks=1) >>> print(''' ... Package: %s @@ -911,7 +911,7 @@ Write the changelog out to the filehandle passed. The file argument must be an open file object. """ - filehandle.write(self.__str__()) + filehandle.write(str(self)) def get_maintainer(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/deb822.py new/python-debian-0.1.49/lib/debian/deb822.py --- old/python-debian-0.1.48/lib/debian/deb822.py 2022-09-11 03:34:50.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/deb822.py 2022-11-10 03:25:12.000000000 +0100 @@ -295,6 +295,8 @@ # 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 = { @@ -459,7 +461,7 @@ if hasattr(_dict, 'items'): items = _dict.items() # type: ignore else: - items = list(_dict) # type: ignore + items = list(_dict) try: for k, v in items: @@ -762,7 +764,7 @@ @staticmethod def _skip_useless_lines(sequence): - # type: (IterableInputDataType) -> Union[Iterator[bytes]] + # type: (IterableInputDataType) -> Iterator[bytes] """Yields only lines that do not begin with '#'. Also skips any blank lines at the beginning of the input. @@ -812,9 +814,9 @@ curkey = None content = "" - for linebytes in self.gpg_stripped_paragraph( + for linebytes in self._gpg_stripped_paragraph( self._skip_useless_lines(sequence), strict): - line = self.decoder.decode(linebytes) + line = self.decoder.decode_bytes(linebytes) m = self._new_field_re.match(line) if m: @@ -1101,6 +1103,18 @@ Control over the strictness of the parser. See the :class:`Deb822` class documentation for details. """ + # Some consumers of this method require bytes (encoding + # detection and signature checking). However, we might have + # been given a file opened in text mode, in which case it's + # simplest to encode to bytes. + _encoded_sequence = (x.encode() if isinstance(x, str) else x for x in sequence) + return Deb822._split_gpg_and_payload(_encoded_sequence, strict=strict) + + @staticmethod + def _split_gpg_and_payload(sequence, # type: Iterator[bytes] + strict=None, # type: Optional[Dict[str, bool]] + ): + # type: (...) -> Tuple[List[bytes], List[bytes], List[bytes]] # pylint: disable=too-many-branches if not strict: @@ -1116,16 +1130,7 @@ accept_empty_or_whitespace = strict.get('whitespace-separates-paragraphs', True) first_line = True - for line_ in sequence: - # Some consumers of this method require bytes (encoding - # detection and signature checking). However, we might have - # been given a file opened in text mode, in which case it's - # simplest to encode to bytes. - if isinstance(line_, str): - line = line_.encode() - else: - line = line_ - + for line in sequence: line = line.strip(b'\r\n') # skip initial blank lines, if any @@ -1174,9 +1179,9 @@ raise EOFError('only blank lines found in input') @classmethod - def gpg_stripped_paragraph(cls, sequence, strict=None): - # type: (Union[Iterator[bytes], Iterator[str]], Optional[Dict[str, bool]]) -> List[bytes] - return cls.split_gpg_and_payload(sequence, strict)[1] + def _gpg_stripped_paragraph(cls, sequence, strict=None): + # type: (Iterator[bytes], Optional[Dict[str, bool]]) -> List[bytes] + return cls._split_gpg_and_payload(sequence, strict)[1] def get_gpg_info(self, keyrings=None): # type: (Optional[Iterable[str]]) -> GpgInfo @@ -1197,14 +1202,14 @@ if self.gpg_info is None: # pylint: disable=no-member # (raw_text is checked above) - self.gpg_info = GpgInfo.from_sequence(self.raw_text, # type: ignore + self.gpg_info = GpgInfo.from_sequence(self.raw_text, keyrings=keyrings) return self.gpg_info def validate_input(self, key, value): # type: (str, str) -> None - # pylint: disable=no-self-use,unused-argument + # pylint: disable=unused-argument """Raise ValueError if value is not a valid value for key Subclasses that do interesting things for different keys may wish to @@ -1212,14 +1217,14 @@ """ # FIXME: key is not validated, contrary to docstring + if '\n' not in value: + return + # The value cannot end in a newline (if it did, dumping the object # would result in multiple stanzas) if value.endswith('\n'): raise ValueError("value must not end in '\\n'") - if '\n' not in value: - return - # Make sure there are no blank lines (actually, the first one is # allowed to be blank, but no others), and each subsequent line starts # with whitespace @@ -2594,22 +2599,25 @@ # type: (Union[str, bytes]) -> str """If value is not already Unicode, decode it intelligently.""" if isinstance(value, bytes): + return self.decode_bytes(value) + return value + + def decode_bytes(self, value): + # type: (bytes) -> str + try: + return value.decode(self.encoding) + except UnicodeDecodeError as e: + # Evidently, the value wasn't encoded with the encoding the + # user specified. Try detecting it. + logger.warning('decoding from %s failed; attempting to detect ' + 'the true encoding', self.encoding) + result = chardet.detect(value) try: - return value.decode(self.encoding) - except UnicodeDecodeError as e: - # Evidently, the value wasn't encoded with the encoding the - # user specified. Try detecting it. - logger.warning('decoding from %s failed; attempting to detect ' - 'the true encoding', self.encoding) - result = chardet.detect(value) - try: - return value.decode(result['encoding']) - except UnicodeDecodeError: - raise e - else: - # Assume the rest of the paragraph is in this encoding as - # well (there's no sense in repeating this exercise for - # every field). - self.encoding = result['encoding'] - else: - return value + decoded = value.decode(result['encoding']) + # Assume the rest of the paragraph is in this encoding as + # well (there's no sense in repeating this exercise for + # every field). + self.encoding = result['encoding'] + return decoded + except UnicodeDecodeError: + raise e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/debfile.py new/python-debian-0.1.49/lib/debian/debfile.py --- old/python-debian-0.1.48/lib/debian/debfile.py 2022-09-11 03:34:50.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/debfile.py 2022-10-16 07:54:15.000000000 +0200 @@ -49,7 +49,11 @@ ) 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/debian/debian_support.py new/python-debian-0.1.49/lib/debian/debian_support.py --- old/python-debian-0.1.48/lib/debian/debian_support.py 2022-09-11 03:34:50.000000000 +0200 +++ new/python-debian-0.1.49/lib/debian/debian_support.py 2022-10-31 15:38:00.000000000 +0100 @@ -580,6 +580,7 @@ ("bullseye", "11"), ("bookworm", "12"), ("trixie", "13"), + ("forky", "14"), ("sid", "")) for idx, rel in enumerate(rels): name, version = rel @@ -720,7 +721,7 @@ with open(local_new, 'w+', encoding=encoding) as new_file: for l in lines: new_file.write(l) - os.rename(local_new, local) + os.replace(local_new, local) finally: if os.path.exists(local_new): os.unlink(local_new) @@ -734,24 +735,13 @@ """Downloads a file from a remote location and gunzips it. Returns the lines in the file.""" - - # The implementation is rather crude, but it seems that the gzip - # module needs a real file for input. - # pylint: disable=import-outside-toplevel import gzip - import tempfile - from urllib.request import urlretrieve + from urllib.request import urlopen - (handle, fname) = tempfile.mkstemp() - try: - os.close(handle) - (filename, _) = urlretrieve(remote, fname) - with gzip.open(filename, 'rt') as gfile: - lines = gfile.readlines() - finally: - os.unlink(fname) - return lines + with urlopen(remote) as zfd: + with gzip.open(zfd, mode="rt") as gfd: + return gfd.readlines() # type: ignore downloadGunzipLines = function_deprecated_by(download_gunzip_lines) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-debian-0.1.48/lib/python_debian.egg-info/PKG-INFO new/python-debian-0.1.49/lib/python_debian.egg-info/PKG-INFO --- old/python-debian-0.1.48/lib/python_debian.egg-info/PKG-INFO 2022-10-15 07:04:01.000000000 +0200 +++ new/python-debian-0.1.49/lib/python_debian.egg-info/PKG-INFO 2022-11-20 01:43:20.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: python-debian -Version: 0.1.48 +Version: 0.1.49 Summary: Debian package related modules Home-page: https://salsa.debian.org/python-debian-team/python-debian Maintainer: Debian python-debian Maintainers