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

View File

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