[opensuse-commit] commit python-netpbmfile for openSUSE:Factory
Hello community, here is the log from the commit of package python-netpbmfile for openSUSE:Factory checked in at 2020-11-29 12:30:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-netpbmfile (Old) and /work/SRC/openSUSE:Factory/.python-netpbmfile.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-netpbmfile" Sun Nov 29 12:30:04 2020 rev:2 rq:851330 version:2020.10.18 Changes: -------- --- /work/SRC/openSUSE:Factory/python-netpbmfile/python-netpbmfile.changes 2020-08-14 13:11:08.821251751 +0200 +++ /work/SRC/openSUSE:Factory/.python-netpbmfile.new.5913/python-netpbmfile.changes 2020-11-29 12:30:17.730115492 +0100 @@ -1,0 +2,9 @@ +Thu Nov 26 06:58:50 UTC 2020 - andy great <andythe_great@pm.me> + +- Update to version 2020.10.18. + * Disallow comments after last value in PNM headers. +- Update since 2020.1.1 + Remove support for Python 3.6. + Support os.PathLike file names. + +------------------------------------------------------------------- Old: ---- netpbmfile-2020.1.1.tar.gz New: ---- netpbmfile-2020.10.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-netpbmfile.spec ++++++ --- /var/tmp/diff_new_pack.4WaPDy/_old 2020-11-29 12:30:18.378116148 +0100 +++ /var/tmp/diff_new_pack.4WaPDy/_new 2020-11-29 12:30:18.382116152 +0100 @@ -20,7 +20,7 @@ %define packagename netpbmfile %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-netpbmfile -Version: 2020.1.1 +Version: 2020.10.18 Release: 0 Summary: Read and write image files in the Netpbm format License: BSD-3-Clause @@ -28,13 +28,13 @@ URL: https://www.lfd.uci.edu/~gohlke/ Source: https://github.com/cgohlke/netpbmfile/archive/v%{version}.tar.gz#/%{packagename}-%{version}.tar.gz BuildRequires: %{python_module Cython} -BuildRequires: %{python_module matplotlib >= 3.1} -BuildRequires: %{python_module numpy >= 1.14} +BuildRequires: %{python_module matplotlib >= 3.2} +BuildRequires: %{python_module numpy >= 1.15} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-matplotlib >= 3.1 -Requires: python-numpy >= 1.14 +Requires: python-matplotlib >= 3.2 +Requires: python-numpy >= 1.15 Requires(post): update-alternatives Requires(postun): update-alternatives BuildArch: noarch ++++++ netpbmfile-2020.1.1.tar.gz -> netpbmfile-2020.10.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbmfile-2020.1.1/README.rst new/netpbmfile-2020.10.18/README.rst --- old/netpbmfile-2020.1.1/README.rst 2020-01-18 10:05:20.000000000 +0100 +++ new/netpbmfile-2020.10.18/README.rst 2020-10-18 15:13:28.000000000 +0200 @@ -24,16 +24,21 @@ :License: BSD 3-Clause -:Version: 2020.1.1 +:Version: 2020.10.18 Requirements ------------ -* `CPython >= 3.6 <https://www.python.org>`_ -* `Numpy 1.14 <https://www.numpy.org>`_ -* `Matplotlib 3.1 <https://www.matplotlib.org>`_ (optional for plotting) +* `CPython >= 3.7 <https://www.python.org>`_ +* `Numpy 1.15 <https://www.numpy.org>`_ +* `Matplotlib 3.2 <https://www.matplotlib.org>`_ (optional for plotting) Revisions --------- +2020.10.18 + Disallow comments after last value in PNM headers. +2020.9.18 + Remove support for Python 3.6 (NEP 29). + Support os.PathLike file names. 2020.1.1 Fix reading tightly packed P1 format and ASCII data with inline comments. Remove support for Python 2.7 and 3.5. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbmfile-2020.1.1/netpbmfile/netpbmfile.py new/netpbmfile-2020.10.18/netpbmfile/netpbmfile.py --- old/netpbmfile-2020.1.1/netpbmfile/netpbmfile.py 2020-01-18 10:05:20.000000000 +0100 +++ new/netpbmfile-2020.10.18/netpbmfile/netpbmfile.py 2020-10-18 15:13:28.000000000 +0200 @@ -54,16 +54,21 @@ :License: BSD 3-Clause -:Version: 2020.1.1 +:Version: 2020.10.18 Requirements ------------ -* `CPython >= 3.6 <https://www.python.org>`_ -* `Numpy 1.14 <https://www.numpy.org>`_ -* `Matplotlib 3.1 <https://www.matplotlib.org>`_ (optional for plotting) +* `CPython >= 3.7 <https://www.python.org>`_ +* `Numpy 1.15 <https://www.numpy.org>`_ +* `Matplotlib 3.2 <https://www.matplotlib.org>`_ (optional for plotting) Revisions --------- +2020.10.18 + Disallow comments after last value in PNM headers. +2020.9.18 + Remove support for Python 3.6 (NEP 29). + Support os.PathLike file names. 2020.1.1 Fix reading tightly packed P1 format and ASCII data with inline comments. Remove support for Python 2.7 and 3.5. @@ -109,7 +114,7 @@ """ -__version__ = '2020.1.1' +__version__ = '2020.10.18' __all__ = ('imread', 'imwrite', 'imsave', 'NetpbmFile') @@ -172,7 +177,7 @@ self._fh = filename else: self._fh = open(filename, 'rb') - self.filename = filename + self.filename = os.fspath(filename) self._fh.seek(0) data = self._fh.read(4096) @@ -188,7 +193,8 @@ self._read_pnm_header(data) except Exception as exc: raise ValueError( - f'Not a Netpbm file:\n{data[:32]}') from exc + f'Not a Netpbm file:\n{data[:32]}' + ) from exc if self.magicnum in b'PFPf': dtype = self.byteorder + 'f4' @@ -278,14 +284,17 @@ def __str__(self): """Return information about Netpbm file.""" - return '\n '.join(( - self.__class__.__name__, - os.path.normpath(os.path.normcase(self.filename)), - f'type: {NetpbmFile.MAGIC_NUMBER[self.magicnum].decode("ascii")}', - f'axes: {self.axes}', - 'shape: {}'.format(', '.join(str(i) for i in self.shape)), - f'dtype: {self.dtype}', - )) + magicnum = NetpbmFile.MAGIC_NUMBER[self.magicnum].decode('ascii') + return '\n '.join( + ( + self.__class__.__name__, + os.path.normpath(os.path.normcase(self.filename)), + f'type: {magicnum}', + f'axes: {self.axes}', + 'shape: {}'.format(', '.join(str(i) for i in self.shape)), + f'dtype: {self.dtype}', + ) + ) def _read_pam_header(self, data): """Read PAM header and initialize instance.""" @@ -293,7 +302,7 @@ br'(^P7[\n\r]+(?:(?:[\n\r]+)|(?:#.*)|' br'(HEIGHT\s+\d+)|(WIDTH\s+\d+)|(DEPTH\s+\d+)|(MAXVAL\s+\d+)|' br'(?:TUPLTYPE\s+\w+))*ENDHDR\n)', - data + data, ).groups() self.header = regroups[0] self.magicnum = b'P7' @@ -307,15 +316,20 @@ """Read PNM header and initialize instance.""" bpm = data[1:2] in b'14' regroups = re.search( - b''.join(( - br'(^(P[123456]|P7 332)\s+(?:#.*[\r\n])*', - br'\s*(\d+)\s+(?:#.*[\r\n])*', - br'\s*(\d+)\s+(?:#.*[\r\n])*' * (not bpm), - br'\s*(\d+)\s(?:\s*#.*[\r\n]\s)*)' - )), - data + b''.join( + ( + br'(^(P[123456]|P7 332)\s+(?:#.*[\r\n])*', + br'\s*(\d+)\s+(?:#.*[\r\n])*', + br'\s*(\d+)\s+(?:#.*[\r\n])*' * (not bpm), + # in disagreement with the netpbm doc pages, the netpbm + # man pages only allow a single whitespace character after + # the last value + br'\s*(\d+)\s)', + ) + ), + data, ).groups() - regroups = regroups + (1, ) * bpm + regroups = regroups + (1,) * bpm self.header = regroups[0] self.magicnum = regroups[1] self.width = int(regroups[2]) @@ -326,12 +340,14 @@ def _read_pf_header(self, data): """Read PF header and initialize instance.""" + # there are no comments in these files regroups = re.search( br'(^(P[Ff])\s+(?:#.*[\r\n])*' br'\s*(\d+)\s+(?:#.*[\r\n])*' br'\s*(\d+)\s+(?:#.*[\r\n])*' - br'\s*([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+(?:#.*[\r\n])*)', - data + br'\s*([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)' + br'\s*[\n])', + data, ).groups() self.header = regroups[0] self.magicnum = regroups[1] @@ -344,7 +360,7 @@ def _read_data(self, fh, byteorder=None): """Return image data from open file as numpy array.""" fh.seek(len(self.header)) - data = fh.read() + if byteorder is None: byteorder = self.byteorder if self.magicnum in b'PFPf': @@ -356,24 +372,26 @@ dtype = numpy.dtype(dtype) depth = 1 if self.magicnum == b'P7 332' else self.depth shape = [-1, self.height, self.width, depth] - size = numpy.prod(shape[1:], dtype='int64') - if self.magicnum in b'PFPf': - size *= dtype.itemsize - data = numpy.frombuffer(data[:size], dtype).reshape(shape) - elif self.magicnum in b'P1P2P3': + + if self.magicnum in b'P1P2P3': + data = fh.read() if self.magicnum == b'P1' and data[1] != b' ': data = [bytes([i]) for i in data if i == 48 or i == 49] else: data = [i for i in data.split() if i.isdigit()] + size = numpy.prod(shape[1:], dtype='int64') data = numpy.array(data[:size], dtype) data = data.reshape(shape) - elif self.maxval == 1: - shape[2] = int(math.ceil(self.width / 8)) - data = numpy.frombuffer(data, dtype).reshape(shape) - data = numpy.unpackbits(data, axis=-2)[:, :, :self.width, :] else: - size *= dtype.itemsize - data = numpy.frombuffer(data[:size], dtype).reshape(shape) + bilevel = self.maxval == 1 and self.magicnum not in b'PFPf' + if bilevel: + shape[2] = int(math.ceil(self.width / 8)) + size = numpy.prod(shape[1:], dtype='int64') * dtype.itemsize + data = fh.read(size) + data = numpy.frombuffer(data, dtype).reshape(shape) + if bilevel: + data = numpy.unpackbits(data, axis=-2)[:, :, : self.width, :] + if data.shape[0] < 2: data = data.reshape(data.shape[1:]) if data.shape[-1] < 2: @@ -396,15 +414,19 @@ def _header(self, pam=False): """Return file header as byte string.""" if pam or self.magicnum == b'P7': - header = '\n'.join(( - 'P7', - f'HEIGHT {self.height}', - f'WIDTH {self.width}', - f'DEPTH {self.depth}', - f'MAXVAL {self.maxval}', - '\n'.join(f"TUPLTYPE {i.decode('ascii')}" - for i in self.tupltypes), - 'ENDHDR\n')) + header = '\n'.join( + ( + 'P7', + f'HEIGHT {self.height}', + f'WIDTH {self.width}', + f'DEPTH {self.depth}', + f'MAXVAL {self.maxval}', + '\n'.join( + f"TUPLTYPE {i.decode('ascii')}" for i in self.tupltypes + ), + 'ENDHDR\n', + ) + ) elif self.maxval == 1: header = f'P4 {self.width} {self.height}\n' elif self.depth == 1: @@ -429,6 +451,7 @@ if len(argv) > 1 and '--doctest' in argv: import doctest + doctest.testmod() return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbmfile-2020.1.1/setup.py new/netpbmfile-2020.10.18/setup.py --- old/netpbmfile-2020.1.1/setup.py 2020-01-18 10:05:20.000000000 +0100 +++ new/netpbmfile-2020.10.18/setup.py 2020-10-18 15:13:28.000000000 +0200 @@ -14,14 +14,21 @@ description = re.search(r'"""(.*)\.(?:\r\n|\r|\n)', code).groups()[0] -readme = re.search(r'(?:\r\n|\r|\n){2}"""(.*)"""(?:\r\n|\r|\n){2}__version__', - code, re.MULTILINE | re.DOTALL).groups()[0] +readme = re.search( + r'(?:\r\n|\r|\n){2}"""(.*)"""(?:\r\n|\r|\n){2}__version__', + code, + re.MULTILINE | re.DOTALL, +).groups()[0] -readme = '\n'.join([description, '=' * len(description)] + - readme.splitlines()[1:]) +readme = '\n'.join( + [description, '=' * len(description)] + readme.splitlines()[1:] +) -license = re.search(r'(# Copyright.*?(?:\r\n|\r|\n))(?:\r\n|\r|\n)+""', code, - re.MULTILINE | re.DOTALL).groups()[0] +license = re.search( + r'(# Copyright.*?(?:\r\n|\r|\n))(?:\r\n|\r|\n)+""', + code, + re.MULTILINE | re.DOTALL, +).groups()[0] license = license.replace('# ', '').replace('#', '') @@ -40,12 +47,18 @@ author='Christoph Gohlke', author_email='cgohlke@uci.edu', url='https://www.lfd.uci.edu/~gohlke/', + project_urls={ + 'Bug Tracker': 'https://github.com/cgohlke/netpbmfile/issues', + 'Source Code': 'https://github.com/cgohlke/netpbmfile', + # 'Documentation': 'https://', + }, license='BSD', packages=['netpbmfile'], entry_points={ - 'console_scripts': ['netpbmfile = netpbmfile.netpbmfile:main']}, + 'console_scripts': ['netpbmfile = netpbmfile.netpbmfile:main'] + }, python_requires='>=3.6', - install_requires=['numpy>=1.14.5'], + install_requires=['numpy>=1.15.1'], platforms=['any'], classifiers=[ 'Development Status :: 4 - Beta', @@ -54,8 +67,8 @@ 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', ], )
participants (1)
-
User for buildservice source handling