From a80f0c1f138ec16bb8522c18c9a720ed9497192383b3de1ffa1792ade6a94f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Fri, 30 Oct 2020 12:49:34 +0000 Subject: [PATCH] Accepting request 844950 from home:bnavigator:branches:devel:languages:python - Make executables setup compatible with multiple python3 flavors * update-alternatives for pip3 * use python_clone and python_install_alternative for sip and sip3 * use original sip%{python_bin_suffix} as is * effect: consistent shebangs and specifiers inside the entry_point scripts OBS-URL: https://build.opensuse.org/request/show/844950 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pip?expand=0&rev=83 --- python-pip.changes | 12 ++++++++++++ python-pip.spec | 32 +++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/python-pip.changes b/python-pip.changes index 67c97eb..37eea89 100644 --- a/python-pip.changes +++ b/python-pip.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Oct 30 00:18:04 UTC 2020 - Benjamin Greiner + +- Make executables setup compatible with multiple python3 flavors + * gh#openSUSE/python-rpm-macros#66 + * update-alternatives for pip3 + * use %python_clone and %python_install_alternative for sip and + sip3 + * use original bin/sip%{python_bin_suffix} as is + * effect: consistent shebangs and specifiers inside the + entry_point scripts + ------------------------------------------------------------------- Sun Oct 11 13:08:15 UTC 2020 - Benjamin Greiner diff --git a/python-pip.spec b/python-pip.spec index 7899e81..3cd55fa 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -96,7 +96,10 @@ done %if ! %{with test} %install %python_install -%prepare_alternative pip +%python_clone -a %{buildroot}%{_bindir}/pip +%python_clone -a %{buildroot}%{_bindir}/pip3 +# if we just cloned to pip3-2.7 delete it +rm -f %{buildroot}%{_bindir}/pip3-2* %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif @@ -121,25 +124,32 @@ donttest+=" or test_from_link_vcs_without_source_dir" # Since /usr/bin/pip became ghosted to be used with update-alternatives, we have to get rid # of the old binary resulting from the non-update-alternatives-ified package: [ -h %{_bindir}/pip ] || rm -f %{_bindir}/pip +[ -h %{_bindir}/pip3 ] || rm -f %{_bindir}/pip3 %post -# can't use `python_install_alternative` because it's pipX.Y, not pip-X.Y -PRIO=$(echo %{python_version} | tr -d .) -%install_alternative pip %{_bindir}/pip%{python_version} $PRIO +# keep the alternative groups separate. Users could decide to let pip and pip3 point to +# different flavors +%python_install_alternative pip +%if "%python_flavor" != "python2" +%python_install_alternative pip3 +%endif %postun -%uninstall_alternative pip %{_bindir}/pip%{python_version} +%python_uninstall_alternative pip +%python_uninstall_alternative pip3 %if ! %{with test} %files %{python_files} %license LICENSE.txt %doc AUTHORS.txt NEWS.rst README.rst -%python3_only %{_bindir}/pip -%{_bindir}/pip%{python_version} -%python2_only %{_bindir}/pip2 -%python3_only %{_bindir}/pip3 -%ghost %{_sysconfdir}/alternatives/pip -%{python_sitelib}/pip-%{version}-py%{python_version}.egg-info +%python_alternative %{_bindir}/pip +%if "%{python_flavor}" == "python2" +%{_bindir}/pip2 +%else +%python_alternative %{_bindir}/pip3 +%endif +%{_bindir}/pip%{python_bin_suffix} +%{python_sitelib}/pip-%{version}*-info %{python_sitelib}/pip %endif