From 2314fd928a6940dccb1ffd3ea799e3a779df9645 Mon Sep 17 00:00:00 2001 From: Anna Khaitovich Date: Dec 28 2019 18:16:16 +0000 Subject: Remove stray __pycache__ directory from /usr/bin when running %py_install, %py_install_wheel and %py_install_egg macros Solves bz#1739848 --- diff --git a/macros.python b/macros.python index e431b92..575ddcb 100644 --- a/macros.python +++ b/macros.python @@ -31,15 +31,18 @@ %py_install() %{expand:\\\ CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py_install_egg() %{expand:\\\ mkdir -p %{buildroot}%{python_sitelib} easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py_install_wheel() %{expand:\\\ pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %python_provide() %{lua: diff --git a/macros.python2 b/macros.python2 index 4ff5f41..16e8e4b 100644 --- a/macros.python2 +++ b/macros.python2 @@ -33,13 +33,16 @@ %py2_install() %{expand:\\\ CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py2_install_egg() %{expand:\\\ mkdir -p %{buildroot}%{python2_sitelib} easy_install-%{python2_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python2_version}.egg %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py2_install_wheel() %{expand:\\\ pip%{python2_version} install -I dist/%{1} --root %{buildroot} --no-deps + rm -rfv %{buildroot}%{_bindir}/__pycache__ } diff --git a/macros.python3 b/macros.python3 index b772fb4..36c156e 100644 --- a/macros.python3 +++ b/macros.python3 @@ -27,15 +27,18 @@ %py3_install() %{expand:\\\ CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py3_install_egg() %{expand:\\\ mkdir -p %{buildroot}%{python3_sitelib} easy_install-%{python3_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*} + rm -rfv %{buildroot}%{_bindir}/__pycache__ } %py3_install_wheel() %{expand:\\\ pip%{python3_version} install -I dist/%{1} --root %{buildroot} --no-deps + rm -rfv %{buildroot}%{_bindir}/__pycache__ } # This only supports Python 3.5+ and will never work with Python 2. diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index 79ed93b..c060871 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -81,6 +81,8 @@ install -m 644 %{SOURCE5} \ * Sat Dec 28 2019 Miro Hrončok - 3-51 - Define %%python, but make it work only if %%__python is redefined - Add the %%pycached macro +- Remove stray __pycache__ directory from /usr/bin when running %%py_install, + %%py_install_wheel and %%py_build_wheel macros * Tue Nov 26 2019 Lumír Balhar - 3-50 - Update of bundled compileall2 module