Remove python2-pip

This commit is contained in:
Petr Viktorin 2019-08-21 17:39:35 +02:00
parent ef07805c26
commit 9a8a1ef98e
2 changed files with 5 additions and 142 deletions

View File

@ -1,6 +1,5 @@
%bcond_without tests
%bcond_without python2
%bcond_without doc
%global srcname pip
@ -22,7 +21,7 @@ Name: python-%{srcname}
# When updating, update the bundled libraries versions bellow!
# You can use vendor_meta.sh in the dist git repo
Version: 19.1.1
Release: 7%{?dist}
Release: 8%{?dist}
Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license.
@ -100,10 +99,6 @@ Patch3: remove-existing-dist-only-if-path-conflicts.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1655253
Patch4: dummy-certifi.patch
# When virtualenv is not available, skip the tests instead of failing
# Once we no longer ship or test python2-pip, remove this patch
Patch5: skip-virtualenv-tests.patch
# Downstream only patch
# Users might have local installations of pip from using
# `pip install --user --upgrade pip` on older versions.
@ -175,38 +170,6 @@ Recommends: (libcrypt.so.1 if python%{1}(x86-32))
}
%if %{with python2}
%package -n python2-%{srcname}
Summary: A tool for installing and managing Python 2 packages
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%if %{with tests}
BuildRequires: python2-mock
BuildRequires: python2-pytest
BuildRequires: python2-pretend
BuildRequires: python2-freezegun
BuildRequires: python2-scripttest
BuildRequires: python2-pyyaml
%endif
BuildRequires: ca-certificates
Requires: ca-certificates
Requires: python2-setuptools
# Virtual provides for the packages bundled by pip:
%{bundled 2}
%{?python_provide:%python_provide python2-%{srcname}}
%{crypt_compat_recommends 2}
%description -n python2-%{srcname}
pip is a package management system used to install and manage software packages
written in Python. Many packages can be found in the Python Package Index
(PyPI). pip is a recursive acronym that can stand for either "Pip Installs
Packages" or "Pip Installs Python".
%endif # with python2
%package -n python%{python3_pkgversion}-%{srcname}
Summary: A tool for installing and managing Python3 packages
@ -291,10 +254,6 @@ popd
%patch3 -p1
%patch4 -p1
%if %{with tests}
%patch5 -p1
%endif
# this goes together with patch4
rm src/pip/_vendor/certifi/*.pem
sed -i '/\.pem$/d' src/pip.egg-info/SOURCES.txt
@ -318,20 +277,6 @@ rm docs/build/html/.buildinfo
%install
%if %{with python2}
# 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
# The following is similar to %%py3_install_wheel, but we don't have
# /usr/bin/pip yet, so we install using the wheel directly.
@ -347,29 +292,21 @@ 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
%endif
# before we ln -s anything, we apply Source10 patch to all pips:
for PIP in %{buildroot}%{_bindir}/pip*; do
patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10}
done
mkdir -p %{buildroot}%{bashcompdir}
%if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} \
%{buildroot}%{_bindir}/pip2 completion --bash \
> %{buildroot}%{bashcompdir}/pip2
%endif
PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{buildroot}%{_bindir}/pip completion --bash \
> %{buildroot}%{bashcompdir}/pip
pips2=pip2
pips3=pip
for pip in %{buildroot}%{_bindir}/pip*; do
pip=$(basename $pip)
@ -380,41 +317,20 @@ for pip in %{buildroot}%{_bindir}/pip*; do
ln -s pip %{buildroot}%{bashcompdir}/$pip
%endif
;;
%if %{with python2}
pip2?*)
pips2="$pips2 $pip"
%if 0%{?bashcomp2}
ln -s pip2 %{buildroot}%{bashcompdir}/$pip
%endif
;;
%endif
esac
done
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
-e s/_pip_completion/_pip3_completion/ \
%{buildroot}%{bashcompdir}/pip
%if %{with python2}
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
%{buildroot}%{bashcompdir}/pip2
%endif
# Provide symlinks to executables to comply with Fedora guidelines for Python
%if %{with python2}
ln -s ./pip%{python2_version} %{buildroot}%{_bindir}/pip-%{python2_version}
ln -s ./pip-%{python2_version} %{buildroot}%{_bindir}/pip-2
%endif
ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version}
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 %{with python2}
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
%endif
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
mkdir -p %{buildroot}%{python_wheeldir}
@ -437,39 +353,12 @@ pytest_k='not completion and
mkdir _bin
export PATH="$PWD/_bin:$PATH"
%if %{with python2}
export PYTHONPATH=%{buildroot}%{python2_sitelib}
ln -s %{buildroot}%{_bindir}/pip2 _bin/pip
# test_more_than_one_package assumes virtualenv is present
%{__python2} -m pytest -m 'not network' -k "$(echo $pytest_k) and not test_more_than_one_package"
%endif
export PYTHONPATH=%{buildroot}%{python3_sitelib}
ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%{__python3} -m pytest -m 'not network' -k "$(echo $pytest_k)"
%endif
%if %{with python2}
%files -n python2-%{srcname}
%license LICENSE.txt
%doc README.rst
%if %{with doc}
%{_mandir}/man1/pip2.*
%endif
%{_bindir}/pip2
%{_bindir}/pip-2
%{_bindir}/pip%{python2_version}
%{_bindir}/pip-%{python2_version}
%{python2_sitelib}/pip*
%dir %{bashcompdir}
%if 0%{?bashcomp2}
%{bashcompdir}/pip2*
%dir %(dirname %{bashcompdir})
%endif
%endif # with python2
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE.txt
%doc README.rst
@ -495,7 +384,7 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%license LICENSE.txt
%doc README.rst
%doc docs/build/html
%endif # with doc
%endif
%files wheel
%license LICENSE.txt
@ -505,6 +394,7 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%changelog
* Wed Aug 21 2019 Petr Viktorin <pviktori@redhat.com> - 19.1.1-8
- Remove python2-pip
- 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

View File

@ -1,27 +0,0 @@
diff --git a/tests/lib/venv.py b/tests/lib/venv.py
index 6b63391..126db5b 100644
--- a/tests/lib/venv.py
+++ b/tests/lib/venv.py
@@ -4,8 +4,12 @@ import compileall
import sys
import textwrap
+import pytest
import six
-import virtualenv as _virtualenv
+try:
+ import virtualenv as _virtualenv
+except ImportError:
+ _virtualenv = None
from .path import Path
@@ -20,6 +24,8 @@ class VirtualEnvironment(object):
"""
def __init__(self, location, template=None, venv_type=None):
+ if _virtualenv is None:
+ pytest.skip('virtualenv not available')
assert template is None or venv_type is None
assert venv_type in (None, 'virtualenv', 'venv')
self.location = Path(location)