From 9f542226072f5f82f65845cdbac11b2e97ffd9c0ceae6d017162039face706f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Mon, 3 Jul 2023 13:58:53 +0000 Subject: [PATCH] Accepting request 1096534 from home:Simmphonie:branches:devel:languages:python - update to version 0.20220715.0 * Development moved to gitlab: https://gitlab.com/drj11/pypng * If you pass an empty file to PyPNG it now raises the builtin Python exception EOFError. This should make it easier to diagnose empty file problems separately from genuine format errors (which use png.FormatError). This is a slightly breaking change to the API. * New prirowpng tool to join PNG images in a row left-to-right (old internal pipcat tool). * New pricolpng tool to join PNG images in a column top-to-bottom. * Support for plain PGM files (magic number P2) added to pripamtopng. * New priplan9topng tool to convert from Plan 9 image format to PNG. In reality this has been lurking in the codebase for years, but has recently been converted to Python 3. The author has only a limited collection of Plan 9 images, which limits the testing that can be done. The author welcomes bug reports for Plan 9 images. * The priplan9topng tool has an even more experimental option --font which converts Plan 9 subfont files to a sequence of PNG files. - release 0.0.21 * Support for Python 2 is dropped. * Python 3.5 and onwards are supported. * Some of the ancillary tools are modified to work on Python 3. * Installs via wheel files. * prichunkpng command line tool now has some new options to add * chunks: --iccprofile to add a iCCP chunk (ICC Profile); --physical to add a pHYs chunk, specifying the intended pixel size; --sigbit to add a sBIT chunk, specifying the encoded significant bits; --transparent to add a tRNS chunk, specifying the transparent colour. * priditherpng command line tool standardised and converted to Python 3. * pripngtopam tool now has a --plain option to output plain PGM and PPM formats. The topam part of the name is a bit of a misnomer: when possible (L and RGB PNG files) the tool will output either a PGM (grey) or a PPM (RGB) file. Essentially all tools that can process a PAM file can also process a PGM or a PPM file. PAM files cannot be plain so using the option will raise an error in the case where a true PAM file is written. * Better error messages when you write the wrong number of rows. (Slightly experimentally) running the png module as a command line tool, with python -m png, will report the version and file location of the png module. - remove pr_106.patch - remove pypng-pr104-py39.patch OBS-URL: https://build.opensuse.org/request/show/1096534 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pypng?expand=0&rev=19 --- pr_106.patch | 19 --------------- pypng-0.0.20.tar.gz | 3 --- pypng-0.20220715.0.tar.gz | 3 +++ pypng-pr104-py39.patch | 31 ------------------------ python-pypng.changes | 51 +++++++++++++++++++++++++++++++++++++++ python-pypng.spec | 34 ++++++++++++-------------- 6 files changed, 69 insertions(+), 72 deletions(-) delete mode 100644 pr_106.patch delete mode 100644 pypng-0.0.20.tar.gz create mode 100644 pypng-0.20220715.0.tar.gz delete mode 100644 pypng-pr104-py39.patch diff --git a/pr_106.patch b/pr_106.patch deleted file mode 100644 index af3d94d..0000000 --- a/pr_106.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit 66a8d1bc88f99a05349099e1121ef1f57856cded -Author: John Vandenberg -Date: Sun Sep 13 10:45:51 2020 +0700 - - Remove test modules from runtime distribution - -Index: pypng-0.0.20/setup.py -=================================================================== ---- pypng-0.0.20.orig/setup.py -+++ pypng-0.0.20/setup.py -@@ -40,7 +40,7 @@ https://pypng.readthedocs.io/en/latest/ - author_email='drj@pobox.com', - url='https://github.com/drj11/pypng', - package_dir={'': 'code'}, -- py_modules=['png', 'test_png', 'pngsuite'], -+ py_modules=['png'], - scripts=[ - "code/prichunkpng", - "code/priforgepng", diff --git a/pypng-0.0.20.tar.gz b/pypng-0.0.20.tar.gz deleted file mode 100644 index 839ffe4..0000000 --- a/pypng-0.0.20.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1032833440c91bafee38a42c38c02d00431b24c42927feb3e63b104d8550170b -size 649538 diff --git a/pypng-0.20220715.0.tar.gz b/pypng-0.20220715.0.tar.gz new file mode 100644 index 0000000..5f1b9a3 --- /dev/null +++ b/pypng-0.20220715.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:739c433ba96f078315de54c0db975aee537cbc3e1d0ae4ed9aab0ca1e427e2c1 +size 128992 diff --git a/pypng-pr104-py39.patch b/pypng-pr104-py39.patch deleted file mode 100644 index 7c5ae8e..0000000 --- a/pypng-pr104-py39.patch +++ /dev/null @@ -1,31 +0,0 @@ -From fe9c973c5e92f24746dfa1be8796c14a2befec4f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= -Date: Wed, 15 Jul 2020 07:54:53 +0200 -Subject: [PATCH] test_png: Use array.tobytes to fix py3.9 compatibility - -The deprecated array.tostring() method has been removed in Python 3.9. -Use .tobytes() instead. ---- - code/test_png.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/code/test_png.py b/code/test_png.py -index c858d18..447c314 100644 ---- a/code/test_png.py -+++ b/code/test_png.py -@@ -448,13 +448,13 @@ def test_write_packed(self): - def test_interlaced_array(self): - """Reading an interlaced PNG yields each row as an array.""" - r = png.Reader(bytes=pngsuite.basi0g08) -- list(r.read()[2])[0].tostring -+ list(r.read()[2])[0].tobytes - - def test_trns_array(self): - """A type 2 PNG with tRNS chunk yields each row - as an array (using asDirect).""" - r = png.Reader(bytes=pngsuite.tbrn2c08) -- list(r.asDirect()[2])[0].tostring -+ list(r.asDirect()[2])[0].tobytes - - def test_flat(self): - """Test read_flat.""" diff --git a/python-pypng.changes b/python-pypng.changes index 23159b9..d577bbd 100644 --- a/python-pypng.changes +++ b/python-pypng.changes @@ -1,3 +1,54 @@ +------------------------------------------------------------------- +Mon Jul 3 07:00:03 UTC 2023 - Torsten Gruner + +- update to version 0.20220715.0 + * Development moved to gitlab: https://gitlab.com/drj11/pypng + * If you pass an empty file to PyPNG + it now raises the builtin Python exception EOFError. + This should make it easier to diagnose empty file problems separately + from genuine format errors + (which use png.FormatError). + This is a slightly breaking change to the API. + * New prirowpng tool to join PNG images in a row left-to-right + (old internal pipcat tool). + * New pricolpng tool to join PNG images in a column top-to-bottom. + * Support for plain PGM files (magic number P2) added to pripamtopng. + * New priplan9topng tool to convert from Plan 9 image format to PNG. + In reality this has been lurking in the codebase for years, but + has recently been converted to Python 3. + The author has only a limited collection of Plan 9 images, + which limits the testing that can be done. + The author welcomes bug reports for Plan 9 images. + * The priplan9topng tool has an even more experimental option + --font which converts Plan 9 subfont files to a sequence of PNG files. +- release 0.0.21 + * Support for Python 2 is dropped. + * Python 3.5 and onwards are supported. + * Some of the ancillary tools are modified to work on Python 3. + * Installs via wheel files. + * prichunkpng command line tool now has some new options to add + * chunks: + --iccprofile to add a iCCP chunk (ICC Profile); + --physical to add a pHYs chunk, specifying the intended pixel size; + --sigbit to add a sBIT chunk, specifying the encoded significant bits; + --transparent to add a tRNS chunk, specifying the transparent colour. + * priditherpng command line tool standardised and + converted to Python 3. + * pripngtopam tool now has a --plain option to output plain PGM + and PPM formats. The topam part of the name is a bit of a + misnomer: when possible (L and RGB PNG files) the tool will + output either a PGM (grey) or a PPM (RGB) file. Essentially all + tools that can process a PAM file can also process a PGM or a + PPM file. PAM files cannot be plain so using the option + will raise an error in the case where a true PAM file is + written. + * Better error messages when you write the wrong number of rows. + (Slightly experimentally) running the png module as a command + line tool, with python -m png, will report the version and + file location of the png module. +- remove pr_106.patch +- remove pypng-pr104-py39.patch + ------------------------------------------------------------------- Fri Oct 7 12:15:18 UTC 2022 - Daniel Garcia diff --git a/python-pypng.spec b/python-pypng.spec index 372dbfe..5d241b7 100644 --- a/python-pypng.spec +++ b/python-pypng.spec @@ -1,7 +1,7 @@ # # spec file for package python-pypng # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,22 +16,22 @@ # -%define binaries prichunkpng priforgepng prigreypng pripalpng pripamtopng pripnglsch pripngtopam priweavepng -%{?!python_module:%define python_module() python3-%{**}} +%define binaries prichunkpng priforgepng prigreypng pripalpng pripamtopng pripnglsch pripngtopam priweavepng pricolpng priditherpng priplan9topng prirowpng +%{?sle15_python_module_pythons} Name: python-pypng -Version: 0.0.20 +Version: 0.20220715.0 Release: 0 Summary: Pure Python PNG image encoder/decoder License: MIT Group: Development/Languages/Python -URL: https://github.com/drj11/pypng +URL: https://gitlab.com/drj11/pypng Source: https://files.pythonhosted.org/packages/source/p/pypng/pypng-%{version}.tar.gz -# PATCH-FIX-UPSTREAM pr_106 -- gh#drj11/pypng#106 remove test modules -Patch0: pr_106.patch -# PATCH-FIX-UPSTREAM pypng-pr104-py39.patch -- gh#drj11/pypng#104 -- python 3.9 compat -Patch1: https://github.com/drj11/pypng/pull/104.patch#/pypng-pr104-py39.patch BuildRequires: %{python_module Cython} +BuildRequires: %{python_module base >= 3.5} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildRequires: %{python_module numpy if (%python-base without python36-base)} @@ -44,26 +44,22 @@ BuildArch: noarch PyPNG allows PNG image files to be read and written using pure Python. %prep -%setup -q -n pypng-%{version} -%patch0 -p1 -%if 0%{suse_version} >= 1550 -# The patch for Python 3.9 compatibility breaks Python 2 -%patch1 -p1 -%endif -sed -i -e '/^#!\//, 1d' code/png.py +%setup 1 -q -n pypng-%{version} +sed -i -e '/^#!\//, 1d' code/{exnumpy,iccp,mkiccp,png,pngsuite,texttopng}.py +sed -i 's|license_file = |license_files = |' setup.cfg %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install for b in %{binaries}; do %python_clone -a %{buildroot}%{_bindir}/$b done %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}:code $python code/test_png.py +%pytest %post %{lua: for b in rpm.expand("%{binaries}"):gmatch("%S+") do