From c232204244176732739ecddc5ec93fe30a399705189abf26d86fa147c25e55bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 28 Aug 2020 09:00:57 +0000 Subject: [PATCH 1/2] - Add patch to enforce cythonization: * always-cythonize.patch - Add patch to locate zopfli headers properly: * zopfli-headers.patch - Update to 2020.5.30: * pythhon3 only * add support for more codecs OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-imagecodecs?expand=0&rev=9 --- always-cythonize.patch | 13 +++++++++++++ imagecodecs-2019.5.22.tar.gz | 3 --- imagecodecs-2020.5.30.tar.gz | 3 +++ python-imagecodecs.changes | 15 +++++++++++++++ python-imagecodecs.spec | 29 +++++++++++++++++++---------- zopfli-headers.patch | 13 +++++++++++++ 6 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 always-cythonize.patch delete mode 100644 imagecodecs-2019.5.22.tar.gz create mode 100644 imagecodecs-2020.5.30.tar.gz create mode 100644 zopfli-headers.patch diff --git a/always-cythonize.patch b/always-cythonize.patch new file mode 100644 index 0000000..a7a03dd --- /dev/null +++ b/always-cythonize.patch @@ -0,0 +1,13 @@ +Index: imagecodecs-2020.5.30/setup.py +=================================================================== +--- imagecodecs-2020.5.30.orig/setup.py ++++ imagecodecs-2020.5.30/setup.py +@@ -71,7 +71,7 @@ if 'sdist' in sys.argv: + + + OPTIONS = { +- 'cythonize': sys.version_info >= (3, 10), ++ 'cythonize': True, + 'include_dirs': ['imagecodecs'], + 'library_dirs': [], + 'libraries': ['m'] if sys.platform != 'win32' else [], diff --git a/imagecodecs-2019.5.22.tar.gz b/imagecodecs-2019.5.22.tar.gz deleted file mode 100644 index 08bbf49..0000000 --- a/imagecodecs-2019.5.22.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7cd689549b41dc979fed1a26e668a080e67b276b029d179ae3a9eb27a0187719 -size 6487114 diff --git a/imagecodecs-2020.5.30.tar.gz b/imagecodecs-2020.5.30.tar.gz new file mode 100644 index 0000000..ac896fb --- /dev/null +++ b/imagecodecs-2020.5.30.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8c776922d3a60824d8d3d31ba674a250d1b4d429e81349b5c88c34d4353ddb5 +size 8993252 diff --git a/python-imagecodecs.changes b/python-imagecodecs.changes index 012749d..d839e35 100644 --- a/python-imagecodecs.changes +++ b/python-imagecodecs.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Fri Aug 28 08:37:24 UTC 2020 - Tomáš Chvátal + +- Add patch to enforce cythonization: + * always-cythonize.patch +- Add patch to locate zopfli headers properly: + * zopfli-headers.patch + +------------------------------------------------------------------- +Fri Aug 28 08:20:58 UTC 2020 - Tomáš Chvátal + +- Update to 2020.5.30: + * pythhon3 only + * add support for more codecs + ------------------------------------------------------------------- Mon May 25 10:59:24 UTC 2020 - Petr Gajdos diff --git a/python-imagecodecs.spec b/python-imagecodecs.spec index 1513127..02e6f83 100644 --- a/python-imagecodecs.spec +++ b/python-imagecodecs.spec @@ -19,47 +19,56 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-imagecodecs -Version: 2019.5.22 +Version: 2020.5.30 Release: 0 Summary: Image transformation, compression, and decompression codecs License: BSD-3-Clause -Group: Development/Languages/Python URL: https://www.lfd.uci.edu/~gohlke/ Source: https://files.pythonhosted.org/packages/source/i/imagecodecs/imagecodecs-%{version}.tar.gz -BuildRequires: %{python_module Cython} +Patch0: always-cythonize.patch +Patch1: zopfli-headers.patch +BuildRequires: %{python_module Cython >= 0.29.19} BuildRequires: %{python_module Pillow} BuildRequires: %{python_module blosc} BuildRequires: %{python_module lz4} BuildRequires: %{python_module matplotlib >= 2.2} -BuildRequires: %{python_module numpy-devel >= 1.11.3} +BuildRequires: %{python_module numpy-devel >= 1.15.1} BuildRequires: %{python_module pytest} BuildRequires: %{python_module scikit-image} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module setuptools >= 18.0} +BuildRequires: %{python_module tifffile >= 2020.5.25} BuildRequires: %{python_module zstd} BuildRequires: dos2unix BuildRequires: fdupes BuildRequires: gcc-c++ +BuildRequires: giflib-devel BuildRequires: jxrlib-devel -BuildRequires: libjpeg62-devel +BuildRequires: libaec-devel +BuildRequires: libzopfli-devel BuildRequires: pkgconfig BuildRequires: python-rpm-macros +BuildRequires: snappy-devel BuildRequires: pkgconfig(blosc) BuildRequires: pkgconfig(bzip2) BuildRequires: pkgconfig(lcms2) +BuildRequires: pkgconfig(libbrotlicommon) +BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(liblz4) BuildRequires: pkgconfig(liblzma) BuildRequires: pkgconfig(libopenjp2) BuildRequires: pkgconfig(libpng) +BuildRequires: pkgconfig(libtiff-4) BuildRequires: pkgconfig(libwebp) BuildRequires: pkgconfig(libzstd) BuildRequires: pkgconfig(zlib) -Requires: python-numpy >= 1.11.3 +Requires: python-numpy >= 1.15.1 Requires(post): update-alternatives Requires(postun): update-alternatives Recommends: python-Pillow Recommends: python-blosc Recommends: python-lz4 -Recommends: python-matplotlib >= 2.2 +Recommends: python-matplotlib >= 3.1 +Recommends: python-tifffile >= 2020.5.25 Recommends: python-zstd %python_subpackages @@ -75,9 +84,9 @@ Delta, XOR Delta, Floating Point Predictor, and Bitorder reversal. %prep %setup -q -n imagecodecs-%{version} +%autopatch -p1 + dos2unix README.rst -# prevent ImportError in CLI due to missing tifffile -sed -i '/from tifffile import imshow/d' imagecodecs/__main__.py %build export CFLAGS="%{optflags}" diff --git a/zopfli-headers.patch b/zopfli-headers.patch new file mode 100644 index 0000000..392d4b0 --- /dev/null +++ b/zopfli-headers.patch @@ -0,0 +1,13 @@ +Index: imagecodecs-2020.5.30/imagecodecs/zopfli.pxd +=================================================================== +--- imagecodecs-2020.5.30.orig/imagecodecs/zopfli.pxd ++++ imagecodecs-2020.5.30/imagecodecs/zopfli.pxd +@@ -4,7 +4,7 @@ + # Cython declarations for the `Zopfli 1.0.3` library. + # https://github.com/google/zopfli + +-cdef extern from 'zopfli/zopfli.h': ++cdef extern from 'zopfli.h': + + ctypedef struct ZopfliOptions: + int verbose From 88299ee7fe29b12678b1284f1ca212bf5de1a78c0d976fbf9f28af58aab84c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 28 Aug 2020 09:21:22 +0000 Subject: [PATCH 2/2] - Switch to multibuild to not cycle OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-imagecodecs?expand=0&rev=10 --- _multibuild | 3 ++ python-imagecodecs.changes | 5 ++++ python-imagecodecs.spec | 56 ++++++++++++++++++++++++++------------ 3 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 _multibuild diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/python-imagecodecs.changes b/python-imagecodecs.changes index d839e35..108890d 100644 --- a/python-imagecodecs.changes +++ b/python-imagecodecs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Aug 28 09:20:47 UTC 2020 - Tomáš Chvátal + +- Switch to multibuild to not cycle + ------------------------------------------------------------------- Fri Aug 28 08:37:24 UTC 2020 - Tomáš Chvátal diff --git a/python-imagecodecs.spec b/python-imagecodecs.spec index 02e6f83..901e0c2 100644 --- a/python-imagecodecs.spec +++ b/python-imagecodecs.spec @@ -17,8 +17,16 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif %define skip_python2 1 -Name: python-imagecodecs +Name: python-imagecodecs%{psuffix} Version: 2020.5.30 Release: 0 Summary: Image transformation, compression, and decompression codecs @@ -28,18 +36,30 @@ Source: https://files.pythonhosted.org/packages/source/i/imagecodecs/ima Patch0: always-cythonize.patch Patch1: zopfli-headers.patch BuildRequires: %{python_module Cython >= 0.29.19} -BuildRequires: %{python_module Pillow} -BuildRequires: %{python_module blosc} -BuildRequires: %{python_module lz4} -BuildRequires: %{python_module matplotlib >= 2.2} BuildRequires: %{python_module numpy-devel >= 1.15.1} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module scikit-image} BuildRequires: %{python_module setuptools >= 18.0} -BuildRequires: %{python_module tifffile >= 2020.5.25} -BuildRequires: %{python_module zstd} BuildRequires: dos2unix BuildRequires: fdupes +Requires: python-numpy >= 1.15.1 +Requires(post): update-alternatives +Requires(postun): update-alternatives +Recommends: python-Pillow +Recommends: python-blosc +Recommends: python-lz4 +Recommends: python-matplotlib >= 3.1 +Recommends: python-tifffile >= 2020.5.25 +Recommends: python-zstd +%if %{with test} +BuildRequires: %{python_module Pillow} +BuildRequires: %{python_module blosc} +BuildRequires: %{python_module imagecodecs >= %{version}} +BuildRequires: %{python_module lz4} +BuildRequires: %{python_module matplotlib >= 3.1} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module scikit-image} +BuildRequires: %{python_module tifffile >= 2020.5.25} +BuildRequires: %{python_module zstd} +%else BuildRequires: gcc-c++ BuildRequires: giflib-devel BuildRequires: jxrlib-devel @@ -61,15 +81,7 @@ BuildRequires: pkgconfig(libtiff-4) BuildRequires: pkgconfig(libwebp) BuildRequires: pkgconfig(libzstd) BuildRequires: pkgconfig(zlib) -Requires: python-numpy >= 1.15.1 -Requires(post): update-alternatives -Requires(postun): update-alternatives -Recommends: python-Pillow -Recommends: python-blosc -Recommends: python-lz4 -Recommends: python-matplotlib >= 3.1 -Recommends: python-tifffile >= 2020.5.25 -Recommends: python-zstd +%endif %python_subpackages %description @@ -89,23 +101,30 @@ Delta, XOR Delta, Floating Point Predictor, and Bitorder reversal. dos2unix README.rst %build +%if !%{with test} export CFLAGS="%{optflags}" %python_build +%endif %install +%if !%{with test} %python_install %python_clone -a %{buildroot}%{_bindir}/imagecodecs %{python_expand rm -rf %{buildroot}%{$python_sitearch}/imagecodecs/licenses/ %fdupes %{buildroot}%{$python_sitearch} } +%endif %check +%if %{with test} mv imagecodecs __imagecodecs # Should add --doctest-modules %%{buildroot}%%{$python_sitearch}/imagecodecs/imagecodecs.py # however doctests are currently broken %pytest_arch tests mv __imagecodecs imagecodecs +%endif +%if !%{with test} %post %python_install_alternative imagecodecs @@ -117,5 +136,6 @@ mv __imagecodecs imagecodecs %doc README.rst %python_alternative %{_bindir}/imagecodecs %{python_sitearch}/* +%endif %changelog