Make /usr/bin/pip Python 3

This commit is contained in:
Miro Hrončok 2019-07-16 10:35:04 +02:00
parent 5813f49ff1
commit 8fc8d4526b

View File

@ -240,6 +240,8 @@ Requires: python%{python3_pkgversion}-setuptools
%{bundled 3} %{bundled 3}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
Provides: pip = %{version}-%{release}
Conflicts: python-pip < %{version}-%{release}
%{crypt_compat_recommends 3} %{crypt_compat_recommends 3}
@ -327,37 +329,37 @@ rm docs/build/html/.buildinfo
%install %install
%if %{without bootstrap}
%py3_install_wheel %{python_wheelname}
%else
%py3_install
%endif
# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
# (pip install wheel doesn't overwrite)
rm %{buildroot}%{_bindir}/pip
%if %{with doc}
pushd docs/build/man
install -d %{buildroot}%{_mandir}/man1
for MAN in *1; do
%if %{with python2}
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip2}
%endif
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}
done
popd
%endif # with doc
%if %{with python2} %if %{with python2}
%if %{without bootstrap} %if %{without bootstrap}
%py2_install_wheel %{python_wheelname} %py2_install_wheel %{python_wheelname}
%else %else
%py2_install %py2_install
%endif %endif
# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
# (pip install wheel doesn't overwrite)
rm %{buildroot}%{_bindir}/pip
%endif # with python2 %endif # with python2
%if %{without bootstrap}
%py3_install_wheel %{python_wheelname}
%else
%py3_install
%endif
%if %{with doc}
pushd docs/build/man
install -d %{buildroot}%{_mandir}/man1
for MAN in *1; do
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
%if %{with python2}
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip2}
%endif
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}
done
popd
%endif # with doc
# before we ln -s anything, we apply Source10 patch to all pips: # before we ln -s anything, we apply Source10 patch to all pips:
# we don't do this when bootstrapping because the entrypoints look different # we don't do this when bootstrapping because the entrypoints look different
# this is not worth dealing with because we'll rebuild once more anyway # this is not worth dealing with because we'll rebuild once more anyway
@ -370,40 +372,40 @@ done
mkdir -p %{buildroot}%{bashcompdir} mkdir -p %{buildroot}%{bashcompdir}
%if %{with python2} %if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} \ PYTHONPATH=%{buildroot}%{python2_sitelib} \
%{buildroot}%{_bindir}/pip completion --bash \ %{buildroot}%{_bindir}/pip2 completion --bash \
> %{buildroot}%{bashcompdir}/pip > %{buildroot}%{bashcompdir}/pip2
%endif %endif
PYTHONPATH=%{buildroot}%{python3_sitelib} \ PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{buildroot}%{_bindir}/pip3 completion --bash \ %{buildroot}%{_bindir}/pip completion --bash \
> %{buildroot}%{bashcompdir}/pip3 > %{buildroot}%{bashcompdir}/pip
pips2=pip pips2=pip2
pips3=pip3 pips3=pip
for pip in %{buildroot}%{_bindir}/pip*; do for pip in %{buildroot}%{_bindir}/pip*; do
pip=$(basename $pip) pip=$(basename $pip)
case $pip in case $pip in
%if %{with python2} pip3*)
pip2*) pips3="$pips3 $pip"
pips2="$pips2 $pip"
%if 0%{?bashcomp2} %if 0%{?bashcomp2}
ln -s pip %{buildroot}%{bashcompdir}/$pip ln -s pip %{buildroot}%{bashcompdir}/$pip
%endif %endif
;; ;;
%endif %if %{with python2}
pip3?*) pip2?*)
pips3="$pips3 $pip" pips2="$pips2 $pip"
%if 0%{?bashcomp2} %if 0%{?bashcomp2}
ln -s pip3 %{buildroot}%{bashcompdir}/$pip ln -s pip2 %{buildroot}%{bashcompdir}/$pip
%endif %endif
;; ;;
%endif
esac esac
done done
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \ sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
-e s/_pip_completion/_pip3_completion/ \ -e s/_pip_completion/_pip3_completion/ \
%{buildroot}%{bashcompdir}/pip3 %{buildroot}%{bashcompdir}/pip
%if %{with python2} %if %{with python2}
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \ sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
%{buildroot}%{bashcompdir}/pip %{buildroot}%{bashcompdir}/pip2
%endif %endif
# Provide symlinks to executables to comply with Fedora guidelines for Python # Provide symlinks to executables to comply with Fedora guidelines for Python
@ -466,17 +468,14 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%license LICENSE.txt %license LICENSE.txt
%doc README.rst %doc README.rst
%if %{with doc} %if %{with doc}
%{_mandir}/man1/pip.*
%{_mandir}/man1/pip2.* %{_mandir}/man1/pip2.*
%endif %endif
%{_bindir}/pip
%{_bindir}/pip2 %{_bindir}/pip2
%{_bindir}/pip-2 %{_bindir}/pip-2
%{_bindir}/pip%{python2_version} %{_bindir}/pip%{python2_version}
%{_bindir}/pip-%{python2_version} %{_bindir}/pip-%{python2_version}
%{python2_sitelib}/pip* %{python2_sitelib}/pip*
%dir %{bashcompdir} %dir %{bashcompdir}
%{bashcompdir}/pip
%if 0%{?bashcomp2} %if 0%{?bashcomp2}
%{bashcompdir}/pip2* %{bashcompdir}/pip2*
%dir %(dirname %{bashcompdir}) %dir %(dirname %{bashcompdir})
@ -487,14 +486,17 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%license LICENSE.txt %license LICENSE.txt
%doc README.rst %doc README.rst
%if %{with doc} %if %{with doc}
%{_mandir}/man1/pip.*
%{_mandir}/man1/pip3.* %{_mandir}/man1/pip3.*
%endif %endif
%{_bindir}/pip
%{_bindir}/pip3 %{_bindir}/pip3
%{_bindir}/pip-3 %{_bindir}/pip-3
%{_bindir}/pip%{python3_version} %{_bindir}/pip%{python3_version}
%{_bindir}/pip-%{python3_version} %{_bindir}/pip-%{python3_version}
%{python3_sitelib}/pip* %{python3_sitelib}/pip*
%dir %{bashcompdir} %dir %{bashcompdir}
%{bashcompdir}/pip
%{bashcompdir}/pip3* %{bashcompdir}/pip3*
%if 0%{?bashcomp2} %if 0%{?bashcomp2}
%dir %(dirname %{bashcompdir}) %dir %(dirname %{bashcompdir})
@ -518,6 +520,7 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%changelog %changelog
* Mon Jul 15 2019 Petr Viktorin <pviktori@redhat.com> - 19.1.1-3 * Mon Jul 15 2019 Petr Viktorin <pviktori@redhat.com> - 19.1.1-3
- Recommend libcrypt.so.1 for manylinux1 compatibility - Recommend libcrypt.so.1 for manylinux1 compatibility
- Make /usr/bin/pip Python 3
* Mon Jun 10 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-2 * Mon Jun 10 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-2
- Fix root warning when pip is invoked via python -m pip - Fix root warning when pip is invoked via python -m pip