From 8f6b92fd920aa9934e0d0282a579bd12006ec3125aba7dab306a545cea3db7a3 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 21 Apr 2020 11:55:57 +0000 Subject: [PATCH 1/4] - Fix using update_alternatives. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python2-setuptools?expand=0&rev=9 --- python2-setuptools.changes | 5 +++++ python2-setuptools.spec | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python2-setuptools.changes b/python2-setuptools.changes index ce377d0..340975c 100644 --- a/python2-setuptools.changes +++ b/python2-setuptools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Apr 21 11:55:39 UTC 2020 - Matej Cepl + +- Fix using update_alternatives. + ------------------------------------------------------------------- Tue Apr 7 08:39:25 UTC 2020 - Tomáš Chvátal diff --git a/python2-setuptools.spec b/python2-setuptools.spec index bc7a4f4..a4e9492 100644 --- a/python2-setuptools.spec +++ b/python2-setuptools.spec @@ -57,7 +57,7 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \ %install %python2_install -%prepare_alternative easy_install +%python_clone -a %{buildroot}%{_bindir}/easy_install %fdupes %{buildroot}%{python2_sitelib} %post @@ -72,7 +72,6 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \ %python_alternative %{_bindir}/easy_install %{python2_sitelib}/setuptools %{python2_sitelib}/setuptools-%{version}-py*.egg-info -%{python2_sitelib}/easy_install.py* %dir %{python2_sitelib}/pkg_resources %{python2_sitelib}/pkg_resources/* From fe216bca9496609b35787051a4f1d4c3a6506ef4c58cd54d4438189e5eda300a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 21 Apr 2020 11:59:24 +0000 Subject: [PATCH 2/4] Add sitelib easy_install OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python2-setuptools?expand=0&rev=10 --- python2-setuptools.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python2-setuptools.spec b/python2-setuptools.spec index a4e9492..780f282 100644 --- a/python2-setuptools.spec +++ b/python2-setuptools.spec @@ -70,6 +70,7 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \ %license LICENSE %doc CHANGES.rst README.rst %python_alternative %{_bindir}/easy_install +%{python2_sitelib}/easy_install* %{python2_sitelib}/setuptools %{python2_sitelib}/setuptools-%{version}-py*.egg-info %dir %{python2_sitelib}/pkg_resources From 615e5f2174156bd0a934e002871787a33750459e32456e92d100ec023ca5a4e1 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 21 Apr 2020 12:03:13 +0000 Subject: [PATCH 3/4] python_alternative actually doesn't work without python_subpackages run OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python2-setuptools?expand=0&rev=11 --- python2-setuptools.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python2-setuptools.spec b/python2-setuptools.spec index 780f282..bab5dfb 100644 --- a/python2-setuptools.spec +++ b/python2-setuptools.spec @@ -69,11 +69,12 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \ %files %license LICENSE %doc CHANGES.rst README.rst -%python_alternative %{_bindir}/easy_install +%{_bindir}/easy_install* %{python2_sitelib}/easy_install* %{python2_sitelib}/setuptools %{python2_sitelib}/setuptools-%{version}-py*.egg-info %dir %{python2_sitelib}/pkg_resources %{python2_sitelib}/pkg_resources/* +%ghost %_sysconfdir/alternatives/easy_install %changelog From b178237d7ec99d838b2e9434c993bfb288e2f9886439edc145b2a6c3edeb60ec Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 21 Apr 2020 12:36:46 +0000 Subject: [PATCH 4/4] Another fix of update-alternatives OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python2-setuptools?expand=0&rev=12 --- python2-setuptools.spec | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/python2-setuptools.spec b/python2-setuptools.spec index bab5dfb..b09fc31 100644 --- a/python2-setuptools.spec +++ b/python2-setuptools.spec @@ -57,14 +57,25 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \ %install %python2_install -%python_clone -a %{buildroot}%{_bindir}/easy_install + +# update-alternatives +mkdir -p %{buildroot}%{_bindir} +mv %{buildroot}%{_bindir}/easy_install{,-%{python_version}} +mkdir -p %{buildroot}%{_sysconfdir}/alternatives/ +touch %{buildroot}%{_sysconfdir}/alternatives/easy_install +ln -sf %{_sysconfdir}/alternatives/easy_install \ + %{buildroot}%{_bindir}/easy_install + %fdupes %{buildroot}%{python2_sitelib} %post -%python_install_alternative easy_install +%{_sbindir}/update-alternatives --install %{_bindir}/easy_install \ + easy_install %{_bindir}/easy_install-%{python_version} 27 %postun -%python_uninstall_alternative easy_install +if [ ! -f %{_bindir}/easy_install ] ; then + %{_sbindir}/update-alternatives --remove easy_install %{_bindir}/easy_install-%{python_version} +fi %files %license LICENSE