Name: python-zimscraperlib Version: 5.5.1 Release: 1%{?dist} Summary: Shared code for openZIM scrapers that build ZIM archives # zimscraperlib is GPL-3.0-or-later. The sdist ships two JavaScript files # for offline replay: wombat.js (AGPL-3.0-or-later, fetched by upstream's # build from @webrecorder/wombat 3.11.0) and wombatSetup.js (built by # upstream with rollup from javascript/, GPL-3.0-or-later, bundling uri-js, # BSD-2-Clause). License: GPL-3.0-or-later AND AGPL-3.0-or-later AND BSD-2-Clause URL: https://github.com/openzim/python-scraperlib # The PyPI sdist, not the git tag: it carries the generated rules and the # JavaScript statics, so the build hook downloads nothing. Source0: %{pypi_source zimscraperlib} # Port to python-libzim 4.0: add_illustration() takes (content, width), # search results are SearchResult objects, camelCase search methods and # keyword arguments became snake_case, Archive._get_entry_by_id() is gone. Patch0: zimscraperlib-5.5.1-libzim4.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-pytest BuildRequires: python3-pytest-mock # The build hook runs "python rules/generate_rules.py". BuildRequires: python-unversioned-command # python-libzim needs libzim >= 9.4, which Fedora 43 lacks. BuildRequires: python3-libzim >= 4 # GIF optimization runs gifsicle. BuildRequires: gifsicle %global _description %{expand: zimscraperlib is the common library behind openZIM's scrapers, the tools that turn websites, YouTube channels, TED talks and other sources into ZIM archives for offline reading in Kiwix. It wraps libzim's creator, downloads and re-encodes media, optimizes and resizes images, rewrites HTML, CSS and JavaScript URLs for offline replay (with wombat.js), detects languages and builds full-text indexes from HTML and PDF.} %description %{_description} %package -n python3-zimscraperlib Summary: %{summary} Provides: bundled(js-wombat) = 3.11.0 Provides: bundled(js-uri-js) = 4.4.1 Requires: gifsicle %description -n python3-zimscraperlib %{_description} %prep %autosetup -p1 -n zimscraperlib-%{version} # Upstream pins tightly for its scrapers' reproducibility: # - only Python 3.14 (f45 and rawhide have 3.15; the tests decide); # - libzim < 4.0 (Patch0 ports the two affected calls to python-libzim 4.0); # - pymupdf-lite >= 2 is the PyMuPDF module minus its 2.0 layout engine; # the code uses only open(), metadata and get_text(), which Fedora's # PyMuPDF 1.x has; # - types-xxhash is a typing stub, not needed at run time; # - exact jinja2 and PyYAML versions for the build. sed -i \ -e 's/^requires-python = ">=3.14,<3.15"/requires-python = ">=3.14"/' \ -e 's/"libzim>=3.8.0,<4.0"/"libzim>=3.8.0"/' \ -e 's/"pymupdf-lite>=2.0,<3.0"/"pymupdf"/' \ -e '/"types-xxhash/d' \ -e 's/"jinja2==3.1.6"/"jinja2"/' \ -e 's/"PyYAML==6.0.3"/"PyYAML"/' \ pyproject.toml grep -q '"pymupdf",' pyproject.toml ! grep -q 'types-xxhash\|<3.15\|==3.1.6' pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l zimscraperlib %check %pyproject_check_import # Deselected: tests that fetch URLs or sample ZIMs without the "slow" marker # (slow tests are skipped by default), and one that compares a PNG's exact # byte size, which depends on the zlib and Pillow build. deselect=( tests/download/test_download.py::test_first_block_download_default_session tests/download/test_download.py::test_filehandler "tests/image/test_illustration.py::test_get_zim_illustration[png_url]" "tests/image/test_illustration.py::test_get_zim_illustration[svg_url]" tests/image/test_image.py::test_remove_png_transparency tests/inputs/test_inputs.py::test_remote tests/inputs/test_inputs.py::test_remote_dest tests/inputs/test_inputs.py::test_remote_indir tests/zim/test_archive.py::test_metadata tests/zim/test_archive.py::test_entry_by_id tests/zim/test_archive.py::test_get_item tests/zim/test_archive.py::test_suggestions tests/zim/test_archive.py::test_suggestions_end_index tests/zim/test_archive.py::test_search_no_fti tests/zim/test_archive.py::test_counters tests/zim/test_archive.py::test_get_tags tests/zim/test_zim_creator.py::test_urlitem_html tests/zim/test_zim_creator.py::test_urlitem_binary tests/zim/test_zim_creator.py::test_filelikeprovider_nosize tests/zim/test_zim_creator.py::test_urlprovider tests/zim/test_zim_creator.py::test_urlprovider_nolength ) %pytest ${deselect[@]/#/--deselect=} %files -n python3-zimscraperlib -f %{pyproject_files} %doc README.md CHANGELOG.md %{_bindir}/fix_ogvjs_dist %changelog * Sun Nov 01 2026 Morgan Hough - 5.5.1-1 - Initial package