Make pip bootstrap itself, rather than with an extra bootstrap RPM build

This commit is contained in:
Petr Viktorin 2019-08-21 17:11:03 +02:00
parent 1e1292bcb1
commit ef07805c26
1 changed files with 19 additions and 38 deletions

View File

@ -1,4 +1,3 @@
%bcond_with bootstrap
%bcond_without tests
%bcond_without python2
@ -189,10 +188,6 @@ BuildRequires: python2-freezegun
BuildRequires: python2-scripttest
BuildRequires: python2-pyyaml
%endif
%if %{without bootstrap}
BuildRequires: python2-pip
BuildRequires: python2-wheel
%endif
BuildRequires: ca-certificates
Requires: ca-certificates
Requires: python2-setuptools
@ -231,10 +226,7 @@ BuildRequires: python%{python3_pkgversion}-scripttest
BuildRequires: python%{python3_pkgversion}-virtualenv
BuildRequires: python%{python3_pkgversion}-pyyaml
%endif
%if %{without bootstrap}
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-wheel
%endif
BuildRequires: ca-certificates
Requires: ca-certificates
Requires: python%{python3_pkgversion}-setuptools
@ -265,7 +257,6 @@ A documentation for a tool for installing and managing Python packages
%endif
%if %{without bootstrap}
%package wheel
Summary: The pip wheel
Requires: ca-certificates
@ -279,7 +270,6 @@ Requires: ca-certificates
%description wheel
A Python wheel of pip to use with venv.
%endif
%prep
%setup -q -n %{srcname}-%{version}
@ -316,15 +306,7 @@ ln -s %{python_wheeldir} tests/data/common_wheels
%build
%if %{with python2} && %{with bootstrap}
%py2_build
%endif
%if %{without bootstrap}
%py3_build_wheel
%else
%py3_build
%endif
%if %{with doc}
export PYTHONPATH=./src/
@ -337,22 +319,28 @@ rm docs/build/html/.buildinfo
%install
%if %{with python2}
%if %{without bootstrap}
%py2_install_wheel %{python_wheelname}
%else
%py2_install
%endif
# The following is similar to %%py2_install_wheel, but we don't have
# /usr/bin/pip2 yet, so we install using the wheel directly.
# (This is not standard wheel usage, but the pip wheel supports it -- see
# pip/__main__.py)
%{__python2} dist/%{python_wheelname}/pip install \
-I 'dist/%{python_wheelname}' \
--root %{buildroot} \
--no-deps
# 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
%if %{without bootstrap}
%py3_install_wheel %{python_wheelname}
%else
%py3_install
%endif
# The following is similar to %%py3_install_wheel, but we don't have
# /usr/bin/pip yet, so we install using the wheel directly.
# (This is not standard wheel usage, but the pip wheel supports it -- see
# pip/__main__.py)
%{__python3} dist/%{python_wheelname}/pip install \
-I 'dist/%{python_wheelname}' \
--root %{buildroot} \
--no-deps
%if %{with doc}
pushd docs/build/man
@ -368,13 +356,9 @@ popd
%endif # with doc
# before we ln -s anything, we apply Source10 patch to all pips:
# 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
%if %{without bootstrap}
for PIP in %{buildroot}%{_bindir}/pip*; do
patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10}
done
%endif
mkdir -p %{buildroot}%{bashcompdir}
%if %{with python2}
@ -427,18 +411,14 @@ ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
# Make sure the INSTALLER is not pip, otherwise Patch2 won't work
# TODO Maybe we should make all our python packages have this?
%if %{without bootstrap}
%if %{with python2}
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
%endif
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
%endif
%if %{without bootstrap}
mkdir -p %{buildroot}%{python_wheeldir}
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%endif
%if %{with tests}
@ -517,15 +497,16 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%doc docs/build/html
%endif # with doc
%if %{without bootstrap}
%files wheel
%license LICENSE.txt
# we own the dir for simplicity
%dir %{python_wheeldir}/
%{python_wheeldir}/%{python_wheelname}
%endif
%changelog
* Wed Aug 21 2019 Petr Viktorin <pviktori@redhat.com> - 19.1.1-8
- Make pip bootstrap itself, rather than with an extra bootstrap RPM build
* Sat Aug 17 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-7
- Rebuilt for Python 3.8