File python-blake3.spec of Package python-blake3
#
# spec file for package python-blake3
#
# Copyright (c) 2025 tarcjf
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define print_title() \
set +x; \
echo "==============================================================="; \
echo "%{*}"; \
echo "==============================================================="; \
set -x
Name: python-blake3
Version: 1.0.8
Release: 0
Summary: Python binding for blake3
License: CC0 1.0
URL: https://github.com/oconnor663/blake3-py
# The downloaded file will become `blake3-py-%%{version}.tar.gz` instead of `%%{version}.tar.gz`... This is done by Github...
# The file I uploaded to OBS is also `blake3-py-%%{version}.tar.gz`, so be careful when %%setup
Source0: https://github.com/oconnor663/blake3-py/archive/refs/tags/%{version}.tar.gz#/blake3-py-%{version}.tar.gz
Source1: blake3-py-vendor.tar.xz
BuildRequires: tbb-devel
BuildRequires: zstd
BuildRequires: cargo
BuildRequires: cargo-packaging
%if 0%{?with_clib}
BuildRequires: cmake
BuildRequires: gcc-c++
%endif
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module maturin}
BuildRequires: python-rpm-macros
# Generate python311-, python312-, ...prefix
%python_subpackages
%description
BLAKE3 is a cryptographic hash function with features like Extendable
Output Function (XOF), Key Derivation Functions (KDF), Pseudorandom
Functions (PRF) and Keyed Hashes (MAC). It introduces a Merkle tree
structure that enables parallel computation across multiple cores.
BLAKE3 offers a fixed 256-bit output and targets memory efficiency.
%print_title Before prep
%prep
pwd
ls -l
%print_title Before setup
# Unpack upstream source (GitHub tarball extracts as blake3-py-%{version})
# -n: ensure we cd into the blake3-py-%{version} dir, not %{name}-%{version}
%setup -n blake3-py-%{version}
tar -xf %{SOURCE1}
%print_title After tarballs extracted
pwd
ls -l
echo %{_builddir}
%print_title Before build
%build
# Configure cargo to work in offline mode using vendored crates
export CARGO_HOME=%{_builddir}/cargo-home
export CARGO_NET_OFFLINE=true
export CARGO_VENDOR_DIR=%{_builddir}/vendor
# Build using pyproject-rpm-macros
%pyproject_wheel
%print_title Before install
%install
%pyproject_install
%print_title Before check
%check
# Simple import test to verify the module loads (BUT python-rpm-macros doesn't provide this, so comment.)
# %%pyproject_check_import blake3
%print_title Before files
pwd
ls -l
%files %python_files
%license LICENSE
%doc README.md
%{python3_sitearch}/blake3*.so
%{python3_sitearch}/blake3-*.dist-info