%bcond check 1 Name: python-acls-rs Version: 0.1.1 Release: 1%{?dist} Summary: Python bindings for acls-rs (Access Control Lists) License: MIT OR Apache-2.0 URL: https://codeberg.org/abbra/bac-rules Source: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: python3-devel BuildRequires: python3dist(maturin) >= 1.0 BuildRequires: cargo-rpm-macros >= 24 BuildRequires: rust-acls-rs+default-devel BuildRequires: rust-pyo3+extension-module-devel BuildRequires: rust-pyo3+macros-devel BuildRequires: rust-serde+derive-devel BuildRequires: rust-serde_json+default-devel %global _description %{expand: Python bindings for acls-rs, providing an algebraically-correct permissions system with RBAC, ABAC, and temporal support. Built with PyO3 and maturin.} %description %{_description} %package -n python3-acls-rs Summary: %{summary} %description -n python3-acls-rs %{_description} %files -n python3-acls-rs %license LICENSE-APACHE LICENSE-MIT %doc crates/acls-rs/README.md %{python3_sitearch}/acls_rs/ %{python3_sitearch}/acls_rs-%{version}.dist-info/ %prep %autosetup -n bac-rules -p1 # Trim workspace to only the crates needed for this package so cargo does not # try to resolve dependencies of unrelated workspace members (wasm, benchmarks). sed -i '/^\[workspace\]$/,/^\[/{/^members = \[$/,/^\]/c\members = [\n "crates/acls-rs",\n "crates/bac-python-core",\n "crates/acls-python",\n] }' Cargo.toml # Strip sections from workspace member Cargo.toml files that reference crates # not packaged in Fedora or not needed for the Python binding build: # - wasm32 target deps (js-sys, getrandom/wasm) # - dev-dependencies (criterion — not in Fedora; not needed, we use %%pytest) find crates -name Cargo.toml -exec sed -i \ -e "/^\[target\.'cfg(target_arch/,/^\[/{/^\[target\.'cfg(target_arch/d;/^\[/!d}" \ -e "/^\[dev-dependencies/,/^\[/{/^\[dev-dependencies/d;/^\[/!d}" \ {} + %cargo_prep %generate_buildrequires cd crates/acls-python %pyproject_buildrequires %build cd crates/acls-python %pyproject_wheel %install cd crates/acls-python %pyproject_install %pyproject_save_files acls_rs %if %{with check} %check cd crates/acls-python %pytest %endif %changelog * Wed Jul 08 2026 Alexander Bokovoy - 0.1.1-1 - Initial package