From db76dd30b60d03ab6bb4cd12cdfa938dbe45c8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 14 Apr 2020 14:46:34 +0200 Subject: [PATCH] Define %python, but make it work only if %__python is redefined --- epel-rpm-macros.spec | 5 ++++- macros.epel-rpm-macros | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/epel-rpm-macros.spec b/epel-rpm-macros.spec index 50c2438..b5e9190 100644 --- a/epel-rpm-macros.spec +++ b/epel-rpm-macros.spec @@ -1,6 +1,6 @@ Name: epel-rpm-macros Version: 8 -Release: 9 +Release: 10 Summary: Extra Packages for Enterprise Linux RPM macros Group: System Environment/Base @@ -58,6 +58,9 @@ install -Dpm 644 %{SOURCE3} \ %changelog +* Tue Apr 14 2020 Miro HronĨok - 8-10 +- Define %%python, but make it work only if %%__python is redefined + * Fri Apr 03 2020 Troy Dawson - 8-9 - Add %qt5_qtwebengine_arches to macros diff --git a/macros.epel-rpm-macros b/macros.epel-rpm-macros index 7d3b5fa..ac5376f 100644 --- a/macros.epel-rpm-macros +++ b/macros.epel-rpm-macros @@ -20,6 +20,16 @@ %python2 %__python2 %python3 %__python3 +# Users can use %%python only if they redefined %%__python (e.g. to %%__python3) +%python() %{lua:\ + __python = rpm.expand("%__python")\ + if __python == "/usr/bin/python" then\ + rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\ + else\ + print(__python)\ + end\ +} + # gpgverify verifies signed sources. There is documentation in the script. %gpgverify %{_rpmconfigdir}/gpgverify