From d38048d54daf71dbd4075e8d14725913ad049705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 10 Jun 2019 14:45:52 +0200 Subject: [PATCH] Define %python_sitelib, %python_sitearch, %python_version, %python_version_nodots In rpm 4.15 those are no longer defined. The meaning of "python" is derived from %__python - and that errors by default unless user defined. Example usage: %global __python /usr/bin/pypy3 ... %files %{python_sitelib}/foo/ --- macros.python | 7 +++++++ python-rpm-macros.spec | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/macros.python b/macros.python index 8ad1161..6f81850 100644 --- a/macros.python +++ b/macros.python @@ -1,3 +1,10 @@ +# unversioned macros: used with user defined __python, no longer part of rpm >= 4.15 +%__python %{error:attempt to use unversioned python, define %%__python to %{_bindir}/python2 or %{_bindir}/python3 explicitly} +%python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") +%python_sitearch %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") +%python_version %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") +%python_version_nodots %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") + %py_setup setup.py %py_shbang_opts -s diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index b2b04bd..3b213c3 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,6 +1,6 @@ Name: python-rpm-macros Version: 3 -Release: 42%{?dist} +Release: 43%{?dist} Summary: The unversioned Python RPM macros License: MIT @@ -73,6 +73,11 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \ %changelog +* Mon Jun 10 2019 Miro HronĨok - 3-43 +- Define %%python_sitelib, %%python_sitearch, %%python_version, %%python_version_nodots, + in rpm 4.15 those are no longer defined, the meaning of python is derived from %%__python. +- Usage of %%__python or the above-mentioned macros will error unless user defined. + * Sat Feb 02 2019 Fedora Release Engineering - 3-42 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild