From db76dd30b60d03ab6bb4cd12cdfa938dbe45c8b8 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Apr 14 2020 12:46:34 +0000 Subject: Define %python, but make it work only if %__python is redefined --- 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