public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pypdf] rawhide: Avoid unwanted dependencies on RHEL
@ 2026-08-10 12:15 Yaakov Selkowitz
  0 siblings, 0 replies; only message in thread
From: Yaakov Selkowitz @ 2026-08-10 12:15 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-pypdf
            Branch : rawhide
            Commit : e4d7d982f74c09149837427007a1eeb0769306af
            Author : Yaakov Selkowitz <yselkowi@redhat.com>
            Date   : 2026-08-09T21:44:05-04:00
            Stats  : +26/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pypdf/c/e4d7d982f74c09149837427007a1eeb0769306af?branch=rawhide

            Log:
            Avoid unwanted dependencies on RHEL

psutils version 3 was rewritten in Python and now requires pypdf. RHEL
does not include all the dependencies needed for the docs, extras, or
tests.

---
diff --git a/python-pypdf.spec b/python-pypdf.spec
index c7d38ca..90fb675 100644
--- a/python-pypdf.spec
+++ b/python-pypdf.spec
@@ -1,3 +1,11 @@
+# docs require myst_parser and python3-docs, not in RHEL
+%bcond docs %[%{undefined rhel} || %{defined epel}]
+# fonts support requires fonttools, buildroot only in RHEL
+# image support requires Pillow, not in RHEL
+%bcond extras %[%{undefined rhel} || %{defined epel}]
+# tests require Pillow, pytest-socket, and pytest-timeout, not in RHEL
+%bcond tests %[%{undefined rhel} || %{defined epel}]
+
 %global srcname pypdf
 %global forgeurl https://github.com/py-pdf/pypdf
 
@@ -13,13 +21,17 @@ Source:         %{forgeurl}/archive/%{version}/%{srcname}-%{version}.tar.gz
 
 BuildArch:      noarch
 BuildRequires:  python3-devel
+%if %{with docs}
 BuildRequires:  python3-docs
 BuildRequires:  sed
+%endif
+%if %{with tests}
 # Test dependencies added manually since pyproject.toml doesn't specify them
 # separately from dev dependencies.
 BuildRequires:  python3dist(pytest)
 BuildRequires:  python3dist(pytest-socket)
 BuildRequires:  python3dist(pytest-timeout)
+%endif
 
 %global _description %{expand:
 pypdf is a free and open-source pure-python PDF library capable of splitting,
@@ -34,50 +46,63 @@ Summary:        %{summary}
 
 %description -n python3-pypdf %_description
 
+%if %{with extras}
 %pyproject_extras_subpkg -n python3-pypdf crypto,fonts,image,full
+%endif
 
+%if %{with docs}
 %package        doc
 Summary:        Documentation for %{name}
 Requires:       python3-docs
 
 %description    doc
 This package provides additional documentation for %{name}.
+%endif
 
 %prep
 %autosetup -p1 -n %{srcname}-%{version}
 
+%if %{with docs}
 # Use local intersphinx inventory
 sed -r \
     -e 's|https://docs.python.org/\{python_version\}|%{_docdir}/python3-docs/html|' \
     -i docs/conf.py
+%endif
 
 %generate_buildrequires
-%pyproject_buildrequires -x crypto,fonts,image,full,docs
+%pyproject_buildrequires %{?with_tests:-x crypto,fonts,image,full} %{?with_docs:-x docs}
 
 %build
 %pyproject_wheel
 
+%if %{with docs}
 # Build docs
 sphinx-build-3 docs html
 rm -rf html/{.buildinfo,.doctrees}
+%endif
 
 %install
 %pyproject_install
 %pyproject_save_files %{srcname}
 
 %check
+%pyproject_check_import
+%if %{with tests}
 # Deselect tests downloading files from external hosts and tests requiring
 # sample files which are not included in the source tarball.
 %pytest -m "not enable_socket and not samples"
+%endif
 
 %files -n python3-%{srcname} -f %{pyproject_files}
 # https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/4Y2VRLVAR3DJXBSFVDYJMU3G4ZNPGEU6/
 %license LICENSE
 %doc README.md CHANGELOG.md CONTRIBUTORS.md
 
+%if %{with docs}
 %files doc
 %license LICENSE
 %doc html
+%endif
 
 %changelog
 %autochangelog

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10 12:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 12:15 [rpms/python-pypdf] rawhide: Avoid unwanted dependencies on RHEL Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox