## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global srcname pikepdf

# Bconds are needed for Python bootstrap
%bcond docs 0
%bcond tests 1

Name:           python-%{srcname}
Version:        9.2.1
Release:        %autorelease
Summary:        Read and write PDFs with Python, powered by qpdf

License:        MPL-2.0
URL:            https://github.com/pikepdf/pikepdf
Source:         %pypi_source %{srcname}

BuildRequires:  gcc-c++
BuildRequires:  qpdf-devel >= 11.5.0
BuildRequires:  python3-devel
%if %{with tests}
# Tests:
BuildRequires:  poppler-utils
%endif

%description
pikepdf is a Python library for reading and writing PDF files. pikepdf is
based on QPDF, a powerful PDF manipulation and repair library.


%package -n     python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname}
pikepdf is a Python library for reading and writing PDF files. pikepdf is
based on QPDF, a powerful PDF manipulation and repair library.


%if %{with docs}
%package -n python-%{srcname}-doc
Summary:        pikepdf documentation

# Not autorequired because it's a Fedora-specific subpackage.
BuildRequires:  python3-ipython-sphinx

%description -n python-%{srcname}-doc
Documentation for pikepdf
%endif


%prep
%autosetup -n %{srcname}-%{version} -p1

# Drop coverage requirements
sed -i -e '/coverage/d' -e '/pytest-cov/d' setup.cfg

%if %{with docs}
# We don't build docs against the installed version, so force the version.
sed -i -e "s/release = .\+/release = '%{version}'/g" docs/conf.py
%endif


%generate_buildrequires
%pyproject_buildrequires %{?with_docs: -x docs} %{?with_tests: -x test}


%build
%pyproject_wheel

%if %{with docs}
# generate html docs
export PYTHONPATH="$PWD/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}"
pushd docs
sphinx-build-3 . ../html
popd
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif


%install
%pyproject_install
%pyproject_save_files %{srcname}


%if %{with tests}
%check
%{pytest} -ra
%endif


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE.txt
%doc README.md

%if %{with docs}
%files -n python-%{srcname}-doc
%doc html
%license LICENSE.txt
%endif


%changelog
## START: Generated by rpmautospec
* Fri Sep 27 2024 Packit <hello@packit.dev> - 9.2.1-1
- Update to 9.2.1 upstream release
- Resolves: rhbz#2309100

* Wed Sep 04 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.2.0-2
- Remove outdated condition

* Sun Aug 25 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.2.0-1
- Update to latest version (#2307662)

* Thu Aug 22 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.1.2-1
- Update to latest version (#2306585)

* Wed Aug 21 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.1.1-1
- Update to latest version (#2253924)

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 9.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Wed Jun 19 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.0.0-2
- Fix build with Python 3.13

* Wed Jun 19 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 9.0.0-1
- Update to latest version (#2253924)

* Wed Jun 19 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.15.1-1
- Update to latest version (#2253924)

* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 8.8.0-5
- Rebuilt for Python 3.13

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 8.8.0-4
- Bootstrap for Python 3.13

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Dec 03 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.8.0-1
- Update to latest version (#2252626)

* Mon Nov 20 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.7.1-1
- Update to latest version (#2247206)

* Mon Oct 30 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.5.3-1
- Update to latest version (#2242851)

* Sun Oct 08 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.5.0-1
- Update to latest version (#2238437)

* Mon Sep 11 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.4.1-1
- Update to latest version (#2238211)

* Tue Aug 15 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.4.0-1
- Update to latest version (#2231981)

* Sun Aug 13 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.3.2-1
- Update to latest version (#2228040)

* Sun Jul 30 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 8.2.2-1
- Update to latest version (#2221298)

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sun Jul 02 2023 Python Maint <python-maint@redhat.com> - 7.2.0-4
- Rebuilt for Python 3.12

* Mon Jun 19 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 7.2.0-3
- Flip bconds to enable bootstrap

* Mon Jun 19 2023 Python Maint <python-maint@redhat.com> - 7.2.0-2
- Bootstrap for Python 3.12

* Sat Apr 15 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 7.2.0-1
- Update to latest version (#2186421)

* Mon Mar 27 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 7.1.2-3
- Drop -r option from %%pyproject_buildrequires macro, it's enabled by
  default

* Mon Mar 27 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 7.1.2-2
- Add bconds to disable tests and docs

* Sun Mar 26 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 7.1.2-1
- Update to latest version (#2181776)

* Mon Feb 20 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 7.1.1-1
- Update to latest version (#2158843)

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sat Dec 31 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.7-1
- Update to latest version (#2157162)

* Sun Dec 18 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.6-1
- Update to latest version (#2153665)

* Tue Dec 06 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.5-1
- Update to latest version (#2150602)

* Mon Nov 14 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.4-1
- Update to latest version (#2140871)

* Sun Oct 23 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.1-1
- Update to latest version (#2136456)

* Thu Oct 13 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.2.0-1
- Update to latest version (#2131530)

* Sat Sep 24 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 6.0.2-1
- Update to latest version (#2121905)

* Sat Sep 24 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.6.1-1
- Updatte to latest v5 release (#2121905)

* Mon Aug 22 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.5.0-1
- Update to latest version (#2095189)

* Tue Aug 02 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.3.0-1
- Update to 5.3.0

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jun 16 2022 Python Maint <python-maint@redhat.com> - 5.1.3-2
- Rebuilt for Python 3.11

* Sat May 21 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.1.3-1
- Update to latest version (#2086355)

* Tue May 03 2022 Lumir Balhar <lbalhar@redhat.com> - 5.1.2-2
- Fix test_page_attrs for Python 3.11

* Sun Apr 17 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.1.2-1
- Update to latest version (#2055603)

* Mon Mar 21 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 5.1.0-1
- Update to latest version (#2055603)

* Sun Feb 13 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.5.0-1
- Update to latest version (#2053921)

* Wed Jan 26 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.4.1-1
- Update to latest version (#2036185)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sun Dec 19 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.2.0-1
- Update to latest version (#2031366)

* Wed Dec 01 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.1.0-1
- Update to latest version (#2025358)

* Mon Nov 29 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.2-1
- Update to latest version (#2025358)

* Sun Nov 21 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.1-2
- Force in-tree build for older pip

* Sun Nov 21 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.1-1
- Update to latest version (#2012531)

* Mon Nov 01 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.0-1
- Update to latest version (#2012531)

* Sat Oct 09 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.1.1-1
- Update to latest version (#2010654)

* Wed Sep 22 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.1.0-1
- Update to latest version (#2006573)

* Sun Aug 29 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.0.0-0.3.b3
- Update to 3.0.0b3 (#1993602)

* Sat Aug 21 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.0.0-0.2.b2
- Update to 3.0.0b2 (#1993602)

* Fri Aug 20 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 3.0.0-0.1.b1
- Update to 3.0.0b1.

* Thu Aug 19 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.16.1-2
- Switch to latest Python macros.

* Sat Jul 31 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.16.1-1
- Update to latest version (#1986379)

* Mon Jul 26 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.15.1-1
- Update to latest version (#1983955)

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.15.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jul 16 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.15.0-1
- Update to latest version (#1981984)

* Sun Jul 11 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.14.2-1
- Update to latest version (#1979400)

* Mon Jun 28 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.13.0-1
- Update to latest version (#1974617)

* Sat Jun 19 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.12.2-1
- Update to latest version (#1968156)

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.12.1-2
- Rebuilt for Python 3.10

* Sat May 22 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.12.1-1
- Update to latest version (#1963060)

* Sun May 09 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.12.0-1
- Update to latest version (#1958620)

* Thu Apr 29 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.11.4-1
- Update to latest version (#1953935)

* Tue Apr 27 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.11.3-1
- Update to latest version (#1953935)

* Fri Apr 23 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.11.2-1
- Update to latest version (#1952724)

* Thu Apr 15 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.11.1-1
- Update to latest version (#1948784)

* Fri Apr 09 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.11.0-1
- Update to latest version (#1946953)

* Wed Mar 31 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.10.0-1
- Update to latest version (#1942854)

* Thu Mar 25 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.9.2-1
- Update to latest version (#1942854)

* Sat Mar 20 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.9.1-1
- Update to latest version (#1941127)

* Fri Mar 19 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.9.0-1
- Update to latest version (#1938957)

* Sun Feb 28 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.8.0-1
- Update to latest version (#1933531)

* Sat Feb 27 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.7.0-1
- Update to latest version (#1933453)

* Sat Feb 27 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.6.0-1
- Update to latest version (#1933209)

* Sat Feb 06 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.5.2-1
- Update to latest version
- Fixes rhbz#1920753
- Fixes rhbz#1923549

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sat Jan 16 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.4.0-1
- Update to latest version (#1916969)

* Fri Jan 08 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.3.0-1
- Update to latest version (#1912665)

* Tue Dec 29 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2.4-1
- Update to latest version (#1911403)

* Tue Dec 29 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2.3-1
- Update to latest version (#1911403)

* Wed Dec 23 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2.2-1
- Update to latest version (#1910311)

* Wed Dec 23 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2.1-1
- Update to latest version (#1891776)

* Wed Dec 23 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.19.4-1
- Update to latest version

* Wed Sep 09 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.19.3-1
- Update to latest version (#1877068)

* Mon Sep 07 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.19.1-1
- Update to latest version (#1876202)

* Wed Aug 19 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.19.0-1
- Update to latest version (#1869556)
- Allow latest pytest and pytest-xdist

* Tue Aug 11 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.18.0-1
- Update to latest version (rhbz#1867536)

* Sun Jul 26 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.17.3-1
- Update to latest version

* Fri Jul 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.17.2-1
- Update to latest version

* Tue Jul 14 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.17.1-1
- Update to latest version

* Mon Jul 13 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.17.0-1
- Update to latest version

* Thu Jul 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.16.1-1
- Update to latest version

* Sat Jun 20 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.15.1-1
- Update to latest version

* Sun May 31 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.14.0-1
- Update to latest version

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.13.0-2
- Rebuilt for Python 3.9

* Sun May 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.13.0-1
- Update to latest version

* Fri May 15 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.12.0-1
- Update to latest version

* Mon May 04 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.11.2-1
- Update to latest version

* Fri Apr 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.11.1-1
- Update to latest version

* Tue Apr 14 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.11.0-2
- rebuilt for qpdf-10.0.1

* Mon Apr 13 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.11.0-1
- Update to latest version

* Thu Apr 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.10.4-1
- Update to latest version

* Tue Mar 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.10.3-1
- Update to latest version

* Mon Feb 24 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.10.2-1
- Update to latest version

* Fri Feb 14 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.10.1-1
- Update to latest version

* Tue Jan 28 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.10.0-1
- Update to latest version

* Mon Jan 06 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.8.3-1
- Update to latest version

* Thu Jan 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.8.2-1
- Update to latest version

* Thu Jan 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.8.1-1
- Update to latest version

* Tue Nov 19 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.7.0-2
- rebuilt for qpdf-9.1.0

* Mon Nov 11 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.7.0-1
- Update to latest version

* Mon Oct 21 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.6.5-1
- Update to latest version

* Sun Sep 22 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.6.4-1
- Update to latest version

* Wed Sep 04 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.6.3-1
- Update to latest version

* Fri Aug 30 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.6.2-1
- Update to latest version

* Fri Aug 23 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.6.1-1
- Update to latest version

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5.0-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Mon Jul 22 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.5.0-1
- Update to latest version

* Tue May 14 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.3.0-1
- Update to latest version

* Tue Apr 16 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.2.0-1
- Update to latest version

* Sun Mar 03 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.1.0-1
- Update to latest version

* Tue Feb 12 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.0.5-1
- Update to latest version

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sun Jan 13 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.0.4-1
- Update to latest version

* Sat Jan 05 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.0.1-1
- Update to latest version

* Wed Dec 12 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.7-1
- Update to latest version

* Sat Oct 13 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.5-1
- Update to latest version

* Tue Sep 25 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.3-2
- Force requires to new qpdf

* Mon Sep 24 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.3-1
- Update to latest version

* Tue Aug 21 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.2-1
- Initial package.

## END: Generated by rpmautospec