# siphash24 -- SipHash-1-3 and SipHash-2-4 for Python, a C extension over the # c-util c-siphash library. New to Fedora. Packaged because python-pytools # >= 2025.1.6 requires it, and pyopencl 2025.2.6 (stock Fedora) cannot import # without that pytools (Bugzilla 2432626), which leaves babelbrain with no # OpenCL compute device. # # Upstream's meson build takes the two c-util libraries as wrap-git # subprojects, i.e. it clones them at build time. Copr builds have no network, # and Fedora wants sources in the SRPM anyway, so the pinned revisions are # Source1/Source2 and are unpacked into subprojects/ under the directory names # the .wrap files declare; meson then uses the directories and never fetches. # Both libraries are static-linked into the extension, hence bundled(). %global pypi_name siphash24 %global csiphash_version 1.1.0 %global cstdaux_version 1.5.0 Name: python-%{pypi_name} Version: 1.9 Release: 1%{?dist} Summary: Streaming-capable SipHash-1-3 and SipHash-2-4 implementation # The Python package, c-siphash and c-stdaux all carry the same dual licence. License: Apache-2.0 OR LGPL-2.1-or-later URL: https://github.com/dnicolodi/python-siphash24 Source0: %{pypi_source %{pypi_name}} Source1: https://github.com/c-util/c-siphash/archive/v%{csiphash_version}/c-siphash-%{csiphash_version}.tar.gz Source2: https://github.com/c-util/c-stdaux/archive/v%{cstdaux_version}/c-stdaux-%{cstdaux_version}.tar.gz BuildRequires: python3-devel BuildRequires: gcc BuildRequires: meson %global _description %{expand: A Python implementation of the SipHash-1-3 and SipHash-2-4 keyed hash functions with a hashlib-style streaming interface (update, digest, hexdigest), built on the c-util c-siphash library.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} Provides: bundled(c-siphash) = %{csiphash_version} Provides: bundled(c-stdaux) = %{cstdaux_version} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} # Replace the wrap-git fetch with the pinned sources. The directory names must # match the .wrap file basenames (libcsiphash-1, libcstdaux-1); with the # directories present meson skips the download. tar -xzf %{SOURCE1} -C subprojects mv subprojects/c-siphash-%{csiphash_version} subprojects/libcsiphash-1 tar -xzf %{SOURCE2} -C subprojects mv subprojects/c-stdaux-%{cstdaux_version} subprojects/libcstdaux-1 %generate_buildrequires %pyproject_buildrequires -p %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check %pyproject_check_import # Upstream's unittest file checks digests against the reference vectors. Run # from / so the installed extension is imported, not the source tree. # (the source tree has no siphash24 module, so the import lands in the buildroot) PYTHONPATH=%{buildroot}%{python3_sitearch} %{python3} -m unittest -v test cd / # The call pytools makes. PYTHONPATH=%{buildroot}%{python3_sitearch} %{python3} -c 'from siphash24 import siphash13; assert len(siphash13(b"x").hexdigest()) == 16' %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.rst CHANGELOG.rst %changelog * Sun Oct 11 2026 Morgan Hough - 1.9-1 - Initial package. Needed by python-pytools >= 2025.1.6, which pyopencl 2025.2.6 needs to import at all (Bugzilla 2432626); babelbrain's OpenCL backend is behind that. The c-siphash and c-stdaux meson subprojects are shipped as pinned sources instead of being cloned at build time.