5a88f2d
%global         srcname  img2pdf
5a88f2d
%global         desc   Python 3 library and command line utility img2pdf for losslessly converting\
5a88f2d
a bunch of image files into a PDF file. That means that the images\
5a88f2d
are either inserted into the PDF as-is or they are recompressed using\
5a88f2d
lossless compression. Thus, img2pdf usually runs faster and may yield\
5a88f2d
smaller PDF files than an ImageMagick convert command.\
5a88f2d
\
5a88f2d
The img2pdf command complements the pdfimages command.
5a88f2d
518da6a
Name:           python-%{srcname}
3f170ce
Version:        0.5.1
3f170ce
Release:        1%{?dist}
5a88f2d
Summary:        Lossless images to PDF conversion library and command
5a88f2d
5a88f2d
License:        LGPLv3+
5a88f2d
URL:            https://pypi.org/project/img2pdf
518da6a
Source0:        %pypi_source
5a88f2d
5a3bc71
5a88f2d
BuildArch:      noarch
5a88f2d
6afe8cc
# cf. Bug 1851638 - img2pdf fails to build on s390x because of issues in the ImageMagick dependency
6afe8cc
# https://bugzilla.redhat.com/show_bug.cgi?id=1851638
6afe8cc
ExcludeArch:    s390x
6afe8cc
5b3cbc0
# Disable tests on EPEL8 for now, since some of the dependencies aren't available
5b3cbc0
%if 0%{?epel} == 0
63e1c59
# required for tests
63e1c59
BuildRequires:  python3-pytest
0a6a152
BuildRequires:  ImageMagick
0a6a152
BuildRequires:  ghostscript
0a6a152
BuildRequires:  libtiff-tools
0a6a152
BuildRequires:  mupdf
0a6a152
BuildRequires:  netpbm-progs
0a6a152
BuildRequires:  perl-Image-ExifTool
0a6a152
BuildRequires:  poppler-utils
0a6a152
BuildRequires:  python3-numpy
0a6a152
BuildRequires:  python3-scipy
221f82b
BuildRequires:  icc-profiles-openicc
5b3cbc0
%endif
538a315
0a6a152
# other requirements
5a88f2d
BuildRequires:  python3-devel
538a315
BuildRequires:  python3-setuptools
538a315
538a315
5b3cbc0
%if 0%{?epel} == 0
5a88f2d
BuildRequires:  python3-pillow
63e1c59
BuildRequires:  python3-pikepdf
5b3cbc0
%endif
5b3cbc0
0a6a152
5ca3c62
# The Python dependency generator is enabled by default since f30 or so.
5ca3c62
# It adds `Requires:` for:
5ca3c62
#
63e1c59
# pikepdf
63e1c59
# pillow
5a88f2d
5a88f2d
%description
5a88f2d
%{desc}
5a88f2d
518da6a
%package -n python3-%{srcname}
5a88f2d
Summary:        %{summary}
518da6a
%{?python_provide:%python_provide python3-%{srcname}}
5a88f2d
518da6a
%description -n python3-%{srcname}
5a88f2d
%{desc}
5a88f2d
5a88f2d
%prep
5a88f2d
%autosetup -p1 -n %{srcname}-%{version}
5a88f2d
5b3cbc0
# disable in EPEL builds since pikepdf isn't available on CentOS 8/EPEL
5b3cbc0
# (img2pdf then falls back to its internal PDF engine)
5b3cbc0
#
5b3cbc0
# alternatively, we could disable the python dependency generator, however as of 2020-12
5b3cbc0
# the necessary disable macro isn't available in the epel8 build environment
5b3cbc0
# cf. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/SI5CXXV3MWMEH3PLKAVAJK22FRNI7OGM/
5b3cbc0
%if 0%{?epel} != 0
5b3cbc0
sed -i '/^INSTALL_REQUIRES/,/)/s/\("pikepdf".*$\)/### not available on EPEL ### \1/' setup.py
5b3cbc0
%endif
5b3cbc0
5a88f2d
5a88f2d
%build
5a88f2d
sed -i '1{/^#!\//d}' src/*.py
5a88f2d
%py3_build
5a88f2d
5a88f2d
%install
5a88f2d
%py3_install
5a88f2d
5a88f2d
%check
6dbe437
5b3cbc0
%if 0%{?epel} == 0
ec6ef62
63e1c59
# since the test directly calls src/img2pdf.py
63e1c59
# (file is already installed at this point)
63e1c59
sed -i '1i#!'%{__python3} src/img2pdf.py
63e1c59
221f82b
# cf. https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
3f170ce
#     https://gitlab.mister-muffin.de/josch/img2pdf/issues/187
dff534f
# XXX TODO enable again after issue is resolved
3f170ce
PYTHONPATH=src %{__python3} -m pytest src/img2pdf_test.py -v -k 'not miff_c and not png_icc'
ec6ef62
5b3cbc0
%endif
5a88f2d
518da6a
%files -n python3-%{srcname}
5a88f2d
%{_bindir}/%{srcname}
0a6a152
%{_bindir}/%{srcname}-gui
5a88f2d
%{python3_sitelib}/%{srcname}.py
5a88f2d
%{python3_sitelib}/jp2.py
5a88f2d
%{python3_sitelib}/__pycache__/*
5a88f2d
%{python3_sitelib}/%{srcname}-%{version}*.egg-info
5a88f2d
%doc README.md
5a88f2d
5a88f2d
5a88f2d
%changelog
3f170ce
* Sat Feb 17 2024 Georg Sauthoff <mail@gms.tf> - 0.5.1-1
3f170ce
- Update to latest upstream version (fixes fedora#2251540, fixes fedora#2261573)
3f170ce
20c386f
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-3
20c386f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
20c386f
18bd3d8
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-2
18bd3d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
18bd3d8
221f82b
* Sun Oct 29 2023 Georg Sauthoff <mail@gms.tf> - 0.5.0-1
221f82b
- Update to latest upstream version (fixes fedora#2246691)
221f82b
b429dba
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.4-10
b429dba
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
b429dba
5bf3277
* Mon Jun 19 2023 Python Maint <python-maint@redhat.com> - 0.4.4-9
5bf3277
- Rebuilt for Python 3.12
5bf3277
6b32a52
* Sun May 07 2023 Georg Sauthoff <mail@gms.tf> - 0.4.4-8
6b32a52
- Work-around tiff byte-order assumptions in test cases (fixes fedora#2162999)
6b32a52
9457462
* Sun Apr 16 2023 Georg Sauthoff <mail@gms.tf> - 0.4.4-7
9457462
- Exclude fragile test case.
9457462
2bbeaef
* Sun Jan 22 2023 Georg Sauthoff <mail@gms.tf> - 0.4.4-6
2bbeaef
- Exclude ppc64le due to failing test cases.
2bbeaef
b1929a6
* Sun Jan 22 2023 Georg Sauthoff <mail@gms.tf> - 0.4.4-5
b1929a6
- Skip more test cases on rawhide.
b1929a6
45558e3
* Sun Jan 22 2023 Georg Sauthoff <mail@gms.tf> - 0.4.4-4
45558e3
- Skip some test cases due to updated dependencies until upstream fix.
45558e3
1f2acd0
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.4-3
1f2acd0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
1f2acd0
3d9f322
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.4-2
3d9f322
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
3d9f322
08ac429
* Sat Jul 09 2022 Georg Sauthoff <mail@gms.tf> - 0.4.4-1
08ac429
- Update to latest upstream version (fixes fedora#2073201)
08ac429
f94ff42
* Thu Jun 16 2022 Python Maint <python-maint@redhat.com> - 0.4.3-4
f94ff42
- Rebuilt for Python 3.11
f94ff42
dff534f
* Sat Feb 05 2022 Georg Sauthoff <mail@gms.tf> - 0.4.3-3
dff534f
- Fix test cases due to internal pillow changes (fixes fedora#2046879)
dff534f
580d95b
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.3-2
580d95b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
580d95b
b1f31ad
* Sat Oct 30 2021 Georg Sauthoff <mail@gms.tf> - 0.4.3-1
b1f31ad
- Update to latest upstream version (fixes fedora#2016838)
b1f31ad
5ca3c62
* Sat Oct 16 2021 Georg Sauthoff <mail@gms.tf> - 0.4.2-1
5ca3c62
- Update to latest upstream version (fixes fedora#2012933)
5ca3c62
369f7f8
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.1-2
369f7f8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
369f7f8
ec6ef62
* Sun Jul 04 2021 Georg Sauthoff <mail@gms.tf> - 0.4.1-1
ec6ef62
- Update to latest upstream version (fixes fedora#1958668)
ec6ef62
149980c
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.4.0-6
149980c
- Rebuilt for Python 3.10
149980c
ad9cf6e
* Fri Apr 23 2021 Georg Sauthoff <mail@gms.tf> - 0.4.0-5
ad9cf6e
- Disable fragile test cases for Python 3.10 (fixes fedora#1949003)
ad9cf6e
a1abca0
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-4
a1abca0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
a1abca0
8339b4b
* Sun Dec 27 2020 Georg Sauthoff <mail@gms.tf> - 0.4.0-3
8339b4b
- Support EPEL8 - fix macro expansion
8339b4b
5b3cbc0
* Sat Dec 19 2020 Georg Sauthoff <mail@gms.tf> - 0.4.0-2
5b3cbc0
- Support EPEL8 (fixes fedora#1907226)
5b3cbc0
63e1c59
* Sun Sep 20 2020 Georg Sauthoff <mail@gms.tf> - 0.4.0-1
63e1c59
- Update to latest upstream version (fixes fedora#1867007)
63e1c59
51a013a
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-6
51a013a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
51a013a
6dbe437
* Mon Jun 29 2020 Georg Sauthoff <mail@gms.tf> - 0.3.4-5
6dbe437
- Temporarily disable some tests until next release fixes them.
6dbe437
538a315
* Fri Jun 26 2020 Georg Sauthoff <mail@gms.tf> - 0.3.4-4
538a315
- Be more explicit regarding setuptools depenency,
538a315
  cf. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/GCPGM34ZGEOVUHSBGZTRYR5XKHTIJ3T7/
538a315
16a5003
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.3.4-3
16a5003
- Rebuilt for Python 3.9
16a5003
847aa3f
* Thu Apr 30 2020 Georg Sauthoff <mail@gms.tf> - 0.3.4-2
847aa3f
- Add upstream fix for test suite failure on aarch64
847aa3f
0a6a152
* Sun Apr 26 2020 Georg Sauthoff <mail@gms.tf> - 0.3.4-1
0a6a152
- Update to latest upstream version
0a6a152
cf1b944
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-7
cf1b944
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
cf1b944
8478a5f
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.3.2-6
8478a5f
- Rebuilt for Python 3.8.0rc1 (#1748018)
8478a5f
5156229
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.3.2-5
5156229
- Rebuilt for Python 3.8
5156229
a3c78fc
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-4
a3c78fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
a3c78fc
ddb6609
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-3
ddb6609
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
ddb6609
5a3bc71
* Sat Dec 15 2018 Georg Sauthoff <mail@gms.tf> - 0.3.2-2
5a3bc71
- Fix unittest false-negatives on aarch64
e324cdb
* Sat Nov 24 2018 Georg Sauthoff <mail@gms.tf> - 0.3.2-1
e324cdb
- Update to latest upstream version
518da6a
* Sat Aug 11 2018 Georg Sauthoff <mail@gms.tf> - 0.3.1-1
518da6a
- Update to latest upstream version
518da6a
* Wed Aug 1 2018 Georg Sauthoff <mail@gms.tf> - 0.3.0-1
518da6a
- Update to latest upstream version
5a88f2d
* Tue May 1 2018 Georg Sauthoff <mail@gms.tf> - 0.2.4-1
5a88f2d
- initial packaging