[projects/template-specs] pyproject variants added
arekm
arekm at pld-linux.org
Sun May 4 11:53:49 CEST 2025
commit 1a74c84c35aa902991e007c7c692791be6486435
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun May 4 10:53:35 2025 +0200
pyproject variants added
python3-ext.spec | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/python3-ext.spec b/python3-ext.spec
index 59a7f02..c4d5e7c 100644
--- a/python3-ext.spec
+++ b/python3-ext.spec
@@ -64,6 +64,7 @@ Dokumentacja API modułu Pythona %{module}.
#%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
%build
+# if setup.py
%py3_build
# deprecated target, but sometimes still used: %{?with_tests:test}
@@ -71,7 +72,18 @@ Dokumentacja API modułu Pythona %{module}.
# use explicit plugins list for reliable builds (delete PYTEST_PLUGINS if empty)
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
PYTEST_PLUGINS= \
-%{__python3} -m pytest ...
+%{__python3} -m pytest tests
+%endif
+
+# if pyproject.toml
+%py3_build_pyproject
+
+%if %{with tests}
+%{__python3} -m zipfile -e build-3/*.whl build-3-test
+# use explicit plugins list for reliable builds (delete PYTEST_PLUGINS if empty)
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS= \
+%{__python3} -m pytest -o pythonpath="$PWD/build-3-test" tests
%endif
%if %{with doc}
@@ -83,8 +95,12 @@ rm -rf docs/_build/html/_sources
%install
rm -rf $RPM_BUILD_ROOT
+# if setup.py
%py3_install
+# if pyproject.toml
+%py3_install_pyproject
+
%if %{with enable_if_there_are_examples_provided_in_package}
install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
@@ -102,7 +118,10 @@ rm -rf $RPM_BUILD_ROOT
%{py3_sitedir}/%{module}/*.py
%attr(755,root,root) %{py3_sitedir}/%{module}/*.so
%{py3_sitedir}/%{module}/__pycache__
+# if setup.py
%{py3_sitedir}/%{module}-%{version}-py*.egg-info
+# if pyproject.toml
+%{py3_sitedir}/%{module}-%{version}.dist-info
%{_examplesdir}/%{name}-%{version}
%if %{with doc}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/template-specs.git/commitdiff/1a74c84c35aa902991e007c7c692791be6486435
More information about the pld-cvs-commit
mailing list