From 124685dacf3aa7fd3076647f7636b678aacdd4a6 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sep 18 2018 19:05:41 +0000 Subject: Deal with rpm's inability to replace a directory with another file --- diff --git a/python-q.spec b/python-q.spec index bf4962f..ad5e6ec 100644 --- a/python-q.spec +++ b/python-q.spec @@ -10,7 +10,7 @@ Name: python-%{modname} Version: 2.6 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Quick and dirty python debugging output License: ASL 2.0 @@ -89,10 +89,45 @@ Python 3 version. %endif %if %{with python2} +%pretrans -p -n python2-%{modname} +path = "%{python2_sitelib}/%{modname}-%{version}-py%{python2_version}.egg-info" +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) + end + os.rename(path, path .. ".rpmmoved") + end +end +%endif + +%if %{with_python3} +%pretrans -p -n python3-%{modname} +path = "%{python3_sitelib}/q-2.6-py%{python3_version}.egg-info" +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) + end + os.rename(path, path .. ".rpmmoved") + end +end +%endif + +%if %{with python2} %files -n python2-%{modname} %doc README.md %{python2_sitelib}/%{modname}-*.egg-info %{python2_sitelib}/%{modname}.py* +%ghost %{python2_sitelib}/%{modname}-*.egg-info.rpmmoved/ %endif %if %{with_python3} @@ -101,9 +136,13 @@ Python 3 version. %{python3_sitelib}/%{modname}-*.egg-info %{python3_sitelib}/%{modname}.py %{python3_sitelib}/__pycache__/%{modname}.* +%ghost %{python3_sitelib}/%{modname}-*.egg-info.rpmmoved/ %endif %changelog +* Tue Sep 18 2018 Toshio Kuratomi - - 2.6-10 +- Deal with rpm's inability to replace directories with files + * Tue Sep 18 2018 Toshio Kuratomi - - 2.6-9 - Remove the setuptools dep as it doesn't add anything to the package and this way we wouldn't have to keep setuptools running on the python2 stack.