From 8d3d1dde648226944323560698603f5e88afa124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 25 Oct 2017 21:56:17 +0300 Subject: [PATCH] macros.python*: Use -Es/-I to invoke macro scriptlets To avoid environment and user dir influence. https://bugzilla.redhat.com/show_bug.cgi?id=1506355 --- macros.python2 | 8 ++++---- macros.python3 | 8 ++++---- python-rpm-macros.spec | 5 ++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/macros.python2 b/macros.python2 index 169d48f..fc514c2 100644 --- a/macros.python2 +++ b/macros.python2 @@ -1,8 +1,8 @@ %__python2 /usr/bin/python2 -%python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") -%python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") -%python2_version %(%{__python2} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") -%python2_version_nodots %(%{__python2} -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") +%python2_sitelib %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") +%python2_sitearch %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") +%python2_version %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") +%python2_version_nodots %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") %py2_shbang_opts -s diff --git a/macros.python3 b/macros.python3 index 2805b8a..dc15710 100644 --- a/macros.python3 +++ b/macros.python3 @@ -1,8 +1,8 @@ %__python3 /usr/bin/python3 -%python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") -%python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") -%python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])") -%python3_version_nodots %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3].replace('.',''))") +%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())") +%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") +%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write(sys.version[:3])") +%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write(sys.version[:3].replace('.',''))") %py3dir %{_builddir}/python3-%{name}-%{version}-%{release} %py3_shbang_opts -s diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index ea14756..dcd121b 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,6 +1,6 @@ Name: python-rpm-macros Version: 3 -Release: 22%{?dist} +Release: 23%{?dist} Summary: The unversioned Python RPM macros License: MIT @@ -79,6 +79,9 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \ %changelog +* Thu Oct 26 2017 Ville Skyttä - 3-23 +- Use -Es/-I to invoke macro scriptlets (#1506355) + * Wed Aug 02 2017 Tomas Orsava - 3-22 - Add platform-python macros (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack)