[packages/python3-nh3] - new
qboosh
qboosh at pld-linux.org
Fri Dec 5 18:52:36 CET 2025
commit a6a647f44b935a165f7b451087ce42baa69f648d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Fri Dec 5 18:52:42 2025 +0100
- new
python3-nh3.spec | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
---
diff --git a/python3-nh3.spec b/python3-nh3.spec
new file mode 100644
index 0000000..c0def77
--- /dev/null
+++ b/python3-nh3.spec
@@ -0,0 +1,134 @@
+#
+# Conditional build:
+%bcond_without doc # API documentation
+%bcond_without tests # unit tests
+
+Summary: Python binding to Ammonia HTML sanitizer Rust crate
+Summary(pl.UTF-8): Wiązania Pythona do biblioteki Rusta oczyszczającej HTML Ammonia
+Name: python3-nh3
+Version: 0.3.2
+Release: 1
+License: MIT
+Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/nh3/
+Source0: https://files.pythonhosted.org/packages/source/n/nh3/nh3-%{version}.tar.gz
+# Source0-md5: f1dbd8fe8b87fb4e56318cdb17006d8e
+Source1: nh3-%{version}-vendor.tar.xz
+# Source1-md5: 3cc258d342836e8a66bc1af0e629b35f
+URL: https://pypi.org/project/nh3/
+BuildRequires: python3-build
+BuildRequires: python3-installer
+BuildRequires: python3-devel >= 1:3.8
+BuildRequires: python3-maturin >= 1.0
+BuildRequires: python3-maturin < 2
+BuildRequires: rust
+%if %{with tests}
+BuildRequires: python3-pytest
+%endif
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 2.050
+%if %{with doc}
+BuildRequires: python3-shibuya
+BuildRequires: sphinx-pdg-3
+%endif
+%{?rust_req}
+Requires: python3-modules >= 1:3.8
+ExclusiveArch: %{rust_arches}
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Python bindings to the Ammonia HTML sanitization library.
+<https://github.com/rust-ammonia/ammonia>.
+
+%description -l pl.UTF-8
+Wiązania Pythona do biblioteki oczyszczającej HTML Ammonia
+<https://github.com/rust-ammonia/ammonia>.
+
+%package apidocs
+Summary: API documentation for Python nh3 module
+Summary(pl.UTF-8): Dokumentacja API modułu Pythona nh3
+Group: Documentation
+BuildArch: noarch
+
+%description apidocs
+API documentation for Python nh3 module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona nh3.
+
+%prep
+%setup -q -n nh3-%{version} -a1
+
+# use our offline registry
+export CARGO_HOME="$(pwd)/.cargo"
+
+mkdir -p "$CARGO_HOME"
+cat >.cargo/config.toml <<EOF
+[source.crates-io]
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
+
+%build
+export CARGO_HOME="$(pwd)/.cargo"
+export CARGO_OFFLINE=true
+export CARGO_TERM_VERBOSE=true
+%ifarch x32
+export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnux32
+export PKG_CONFIG_ALLOW_CROSS=1
+export PYO3_CROSS_LIB_DIR=%{_libdir}
+%endif
+
+%py3_build_pyproject
+
+%if %{with doc} || %{with tests}
+%{__python3} -m zipfile -e build-3/*.whl build-3-test
+%endif
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd)/build-3-test \
+%{__python3} -m pytest tests
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd)/build-3-test \
+%{__make} -C docs html \
+ SPHINXBUILD=sphinx-build-3
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+export CARGO_HOME="$(pwd)/.cargo"
+export CARGO_OFFLINE=true
+export CARGO_TERM_VERBOSE=true
+%ifarch x32
+export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnux32
+export PKG_CONFIG_ALLOW_CROSS=1
+%endif
+
+%py3_install_pyproject
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%dir %{py3_sitedir}/nh3
+%{py3_sitedir}/nh3/*.py
+%{py3_sitedir}/nh3/*.pyi
+%{py3_sitedir}/nh3/nh3.abi3.so
+%{py3_sitedir}/nh3/py.typed
+%{py3_sitedir}/nh3/__pycache__
+%{py3_sitedir}/nh3-%{version}.dist-info
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_static,*.html,*.js}
+%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python3-nh3.git/commitdiff/a6a647f44b935a165f7b451087ce42baa69f648d
More information about the pld-cvs-commit
mailing list