[packages/rpm-pld-macros] Introduce py3_build_pyproject and py3_install_pyproject macros (for use with pyproject.toml based py
arekm
arekm at pld-linux.org
Sat Feb 8 14:36:17 CET 2025
commit 3c0f261530e6f869174a8d6dbb2bc35ecbbc97e5
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Feb 8 13:50:06 2025 +0100
Introduce py3_build_pyproject and py3_install_pyproject macros (for use with pyproject.toml based python3 modules)
macros.python | 34 ++++++++++++++++++++++++++++++++++
rpm-pld-macros.spec | 2 +-
2 files changed, 35 insertions(+), 1 deletion(-)
---
diff --git a/rpm-pld-macros.spec b/rpm-pld-macros.spec
index a2d2e45..7abee4f 100644
--- a/rpm-pld-macros.spec
+++ b/rpm-pld-macros.spec
@@ -1,4 +1,4 @@
-%define rpm_macros_rev 2.043
+%define rpm_macros_rev 2.044
%define find_lang_rev 1.42
# split into individual X_prov_ver if there is a reason to desync
%define prov_ver 4.15
diff --git a/macros.python b/macros.python
index b74bf85..367dcf1 100644
--- a/macros.python
+++ b/macros.python
@@ -103,6 +103,40 @@
--root=$RPM_BUILD_ROOT \
}
+# macros for pyproject.toml based builds
+%py3_build_pyproject { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python3} \
+ -m build \
+ --wheel \
+ --no-isolation \
+ --outdir build-3 \
+}
+
+# "shrink" filter to keep this macro without newlines,
+# so it could be used as make arguments
+%py3_install_pyproject_opts() %{shrink: \
+ --prefix=%{_prefix} \
+ --compile-bytecode=2 \
+}
+
+%py3_install_pyproject { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python3} \
+ -m installer \
+ --destdir=$RPM_BUILD_ROOT \
+ %{py3_install_pyproject_opts} \
+ build-3/*.whl \
+}
+
# Hardlink binary identical .pyc and .pyo files
%__spec_install_post_py_hardlink {\
%{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm-pld-macros.git/commitdiff/3c0f261530e6f869174a8d6dbb2bc35ecbbc97e5
More information about the pld-cvs-commit
mailing list