%bcond check 1 Name: python-hbac-rs Version: 0.1.1 Release: 1%{?dist} Summary: Python bindings for hbac-rs (Host-Based Access Control) 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-hbac-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 hbac-rs, providing FreeIPA Host-Based Access Control (HBAC) rule evaluation. Built with PyO3 and maturin.} %description %{_description} %package -n python3-hbac-rs Summary: %{summary} %description -n python3-hbac-rs %{_description} %files -n python3-hbac-rs %license LICENSE-APACHE LICENSE-MIT %doc crates/hbac-rs/README.md %{python3_sitearch}/hbac_rs/ %{python3_sitearch}/hbac_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/hbac-rs",\n "crates/bac-python-core",\n "crates/hbac-python",\n] }' Cargo.toml # Strip wasm32 target deps and dev-dependencies from workspace member # Cargo.toml files — these reference crates not packaged in Fedora and are # not needed for the Python binding build. 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}" \ -e "/cranelift/d" \ {} + %cargo_prep %generate_buildrequires cd crates/hbac-python %pyproject_buildrequires %build cd crates/hbac-python %pyproject_wheel %install cd crates/hbac-python %pyproject_install %pyproject_save_files hbac_rs %if %{with check} %check cd crates/hbac-python %pytest %endif %changelog * Wed Jul 08 2026 Alexander Bokovoy - 0.1.1-1 - Initial package