1
0

- replace imagecodecs_distributor_setup.py with

skip-rare-codecs.patch: this setuptools hook does not get
  called anymore with PEP517 builds

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-imagecodecs?expand=0&rev=34
This commit is contained in:
Dirk Mueller 2024-03-18 19:46:13 +00:00 committed by Git OBS Bridge
parent 769e707a33
commit 84e882b236
4 changed files with 21 additions and 60 deletions

View File

@ -1,49 +0,0 @@
# openSUSE extension setup to build python-imagecodecs
import os
import subprocess
import sys
def customize_build(EXTENSIONS, OPTIONS):
includedir = os.getenv("INCDIR",'') + '/'
del EXTENSIONS['apng'] # png-apng library not available
del EXTENSIONS['brunsli'] # graphics/brunsli not in Factory
del EXTENSIONS['jetraw'] # jetraw library not available
del EXTENSIONS['jpeg8'] # jpeg8 / libjegturbo 2.1.91 is beta and not available
del EXTENSIONS['lerc'] # LERC library not available
del EXTENSIONS['lz4f'] # requires static linking
del EXTENSIONS['mozjpeg'] # Win32 only
EXTENSIONS['avif']['libraries'] = [
'avif',
'aom',
'dav1d',
'rav1e',
]
if sys.maxsize < 2**63 - 1:
# no zfp on 32-bit platforms
del EXTENSIONS['zfp']
# avif tests fail on 32-bit
del EXTENSIONS['avif']
# spng build fail on 32-bit
del EXTENSIONS['spng']
else:
EXTENSIONS['avif']['libraries'].extend([
'SvtAv1Enc',
'SvtAv1Dec',
])
openjpeg_inc = subprocess.check_output(
['pkgconf', '--variable=includedir', 'libopenjp2'],
text=True,
).strip()
EXTENSIONS['jpeg2k']['include_dirs'].append(openjpeg_inc)
EXTENSIONS['jpegxr']['include_dirs'].append(includedir + 'jxrlib')
EXTENSIONS['jpegxl']['libraries'] = ['jxl', 'jxl_threads']
EXTENSIONS['rcomp']['include_dirs'].append(includedir + 'cfitsio')
EXTENSIONS['zopfli']['include_dirs'].append(includedir + 'zopfli')
EXTENSIONS['lzham']['libraries'] = ['lzhamdll']

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Mar 18 19:45:10 UTC 2024 - Dirk Müller <dmueller@suse.com>
- replace imagecodecs_distributor_setup.py with
skip-rare-codecs.patch: this setuptools hook does not get
called anymore with PEP517 builds
-------------------------------------------------------------------
Mon Mar 18 12:27:11 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@ -32,7 +32,7 @@ Summary: Image transformation, compression, and decompression codecs
License: BSD-3-Clause
URL: https://github.com/cgohlke/imagecodecs/
Source: https://files.pythonhosted.org/packages/source/i/imagecodecs/imagecodecs-%{version}.tar.gz
Source1: imagecodecs_distributor_setup.py
Patch1: skip-rare-codecs.patch
ExcludeArch: %ix86 %arm32 ppc s390
BuildRequires: %{python_module Cython >= 3}
BuildRequires: %{python_module base >= 3.8}
@ -139,15 +139,7 @@ Integers, Delta, XOR Delta, Floating Point Predictor, Bitorder reversal,
Bitshuffle, and Float24 (24-bit floating point).
%prep
%setup -q -n imagecodecs-%{version}
# the patch from github requires unix line endings to apply
dos2unix tests/test_imagecodecs.py
dos2unix imagecodecs/libavif.pxd
dos2unix imagecodecs/_avif.pyx
dos2unix imagecodecs/imagecodecs.py
%autopatch -p1
cp %SOURCE1 ./
%autosetup -p1 -n imagecodecs-%{version}
dos2unix README.rst
# These libraries are not linked to, (check SOURCE1)
rm imagecodecs/licenses/LICENSE-brunsli
@ -181,7 +173,7 @@ donttest+=" or test_cms"
%ifarch %ix86 %arm32
donttest="$donttest or spng"
%endif
%pytest_arch -n auto tests -rsXfE --doctest-modules %{$python_sitearch}/imagecodecs/imagecodecs.py -k "not ($donttest ${$python_donttest})"
%pytest_arch -n auto tests -rsXfE -k "not ($donttest ${$python_donttest})"
%endif
%if !%{with test}

11
skip-rare-codecs.patch Normal file
View File

@ -0,0 +1,11 @@
--- imagecodecs-2024.1.1.orig/setup.py
+++ imagecodecs-2024.1.1/setup.py
@@ -246,7 +246,7 @@ def customize_build_default(EXTENSIONS,
del EXTENSIONS['sperr'] # sperr not commonly available
del EXTENSIONS['zlibng'] # zlib-ng library not commonly available
- if 'arch' not in platform.platform():
+ if True:
del EXTENSIONS['jpegls'] # CharLS 2.1 library not commonly available
del EXTENSIONS['jpegxl'] # jpeg-xl library not commonly available
del EXTENSIONS['brunsli'] # Brunsli library not commonly available