Browse Source

python3-pip remove python2 stuff

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
e9eaf98ec7
  1. 153
      SPECS/python3-pip.spec

153
SPECS/python3-pip.spec

@ -1,13 +1,9 @@ @@ -1,13 +1,9 @@
%global with_python3 1
%global build_wheel 0
%global with_tests 0

%global srcname pip
%if 0%{?build_wheel}
%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%if 0%{?with_python3}
%global python3_wheelname %python2_wheelname
%endif
%global python3_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%endif

%global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d})
@ -15,11 +11,11 @@ @@ -15,11 +11,11 @@
%global bashcomp2 1
%endif

Name: python-%{srcname}
Name: python3-%{srcname}
# When updating, update the bundled libraries versions bellow!
Version: 9.0.3
Release: 2%{?dist}
Summary: A tool for installing and managing Python packages
Release: 1%{?dist}
Summary: A tool for installing and managing Python3 packages

Group: Development/Libraries
License: MIT
@ -67,71 +63,6 @@ Patch2: pip-nowarn-upgrade.patch @@ -67,71 +63,6 @@ Patch2: pip-nowarn-upgrade.patch
# %%patch10 doesn't work outside of %%prep, so we add it as a source
Source10: pip9-allow-pip10-import.patch

%description
Pip is a replacement for `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_. It uses mostly the
same techniques for finding packages, so packages that were made
easy_installable should be pip-installable as well.


%package -n python2-%{srcname}
Summary: A tool for installing and managing Python 2 packages
Group: Development/Libraries
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%if 0%{?with_tests}
BuildRequires: python2-mock
BuildRequires: python2-pytest
BuildRequires: python2-pretend
BuildRequires: python2-freezegun
BuildRequires: python2-pytest-capturelog
BuildRequires: python2-scripttest
BuildRequires: python2-virtualenv
%endif
%if 0%{?build_wheel}
BuildRequires: python2-pip
BuildRequires: python2-wheel
%endif
Requires: python2-setuptools

# Virtual provides for the packages bundled by pip.
# You can find the versions in pip/_vendor/vendor.txt file.
# Don't forget to update this bellow for python3 as well.
Provides: bundled(python2dist(appdirs)) = 1.4.0
Provides: bundled(python2dist(cachecontrol)) = 0.11.7
Provides: bundled(python2dist(colorama)) = 0.3.7
Provides: bundled(python2dist(distlib)) = 0.2.4
Provides: bundled(python2dist(distro)) = 1.0.1
Provides: bundled(python2dist(html5lib)) = 1.0b10
Provides: bundled(python2dist(ipaddress) = 1.0.17
Provides: bundled(python2dist(lockfile)) = 0.12.2
Provides: bundled(python2dist(packaging)) = 16.8
Provides: bundled(python2dist(setuptools)) = 28.8.0
Provides: bundled(python2dist(progress)) = 1.2
Provides: bundled(python2dist(pyparsing)) = 2.1.10
Provides: bundled(python2dist(requests)) = 2.11.1
Provides: bundled(python2dist(retrying)) = 1.3.3
Provides: bundled(python2dist(six)) = 1.10.0
Provides: bundled(python2dist(webencodings)) = 0.5

# Bundled within the requests bundle
Provides: bundled(python2dist(chardet)) = 2.3.0
Provides: bundled(python2dist(urllib3)) = 1.16

%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
Pip is a replacement for `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_. It uses mostly the
same techniques for finding packages, so packages that were made
easy_installable should be pip-installable as well.


%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary: A tool for installing and managing Python3 packages
Group: Development/Libraries

BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: bash-completion
@ -175,12 +106,11 @@ Provides: bundled(python3dist(urllib3)) = 1.16 @@ -175,12 +106,11 @@ Provides: bundled(python3dist(urllib3)) = 1.16

%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

%description -n python%{python3_pkgversion}-%{srcname}
%description
Pip is a replacement for `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_. It uses mostly the
same techniques for finding packages, so packages that were made
easy_installable should be pip-installable as well.
%endif # with_python3


%prep
@ -201,120 +131,64 @@ rm pip/_vendor/ordereddict.py @@ -201,120 +131,64 @@ rm pip/_vendor/ordereddict.py

%build
%if 0%{?build_wheel}
%py2_build_wheel
%else
%py2_build
%endif

%if 0%{?with_python3}
%if 0%{?build_wheel}
%py3_build_wheel
%else
%py3_build
%{__python3} setup.py build
%endif
%endif # with_python3


%install
%if 0%{?with_python3}
%if 0%{?build_wheel}
%py3_install_wheel %{python3_wheelname}
# 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
%else
%py3_install
%{__python3} setup.py install --optimize 2 --root %{buildroot}
%endif
%endif # with_python3

%if 0%{?build_wheel}
%py2_install_wheel %{python2_wheelname}
%else
%py2_install
%endif
rm -rf %{buildroot}/usr/bin/pip

# before we ln -s anything, we apply Source10 patch to all pips:
for PIP in %{buildroot}%{_bindir}/pip*; do
patch -p1 $PIP < %{SOURCE10}
done
#for PIP in %{buildroot}%{_bindir}/pip*; do
# patch -p1 $PIP < %{SOURCE10}
#done

mkdir -p %{buildroot}%{bashcompdir}
PYTHONPATH=%{buildroot}%{python_sitelib} \
%{buildroot}%{_bindir}/pip completion --bash \
> %{buildroot}%{bashcompdir}/pip
%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{buildroot}%{_bindir}/pip3 completion --bash \
> %{buildroot}%{bashcompdir}/pip3
%endif
pips2=pip
pips3=pip3
for pip in %{buildroot}%{_bindir}/pip*; do
pip=$(basename $pip)
case $pip in
pip2*)
pips2="$pips2 $pip"
%if 0%{?bashcomp2}
ln -s pip %{buildroot}%{bashcompdir}/$pip
%endif
;;
%if 0%{?with_python3}
pip3?*)
pips3="$pips3 $pip"
%if 0%{?bashcomp2}
ln -s pip3 %{buildroot}%{bashcompdir}/$pip
%endif
;;
%endif
esac
done
%if 0%{?with_python3}
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
-e s/_pip_completion/_pip3_completion/ \
%{buildroot}%{bashcompdir}/pip3
%endif
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
%{buildroot}%{bashcompdir}/pip

# Provide symlinks to executables to comply with Fedora guidelines for Python
ln -s ./pip%{python2_version} %{buildroot}%{_bindir}/pip-%{python2_version}
ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version}
ln -s ./pip-%{python2_version} %{buildroot}%{_bindir}/pip-2
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?
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
%if 0%{?with_python3}
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
%endif
#echo rpm > %{buildroot}%{python3_sitelib}/pip3-%{version}.dist-info/INSTALLER

%if 0%{?with_tests}
%check
py.test -m 'not network'
py.test-%{python3_version} -m 'not network'
%endif


%files -n python2-%{srcname}
%license LICENSE.txt
%doc README.rst docs
%{_bindir}/pip
%{_bindir}/pip2
%{_bindir}/pip-2
%{_bindir}/pip%{python2_version}
%{_bindir}/pip-%{python2_version}
%{python_sitelib}/pip*
%{bashcompdir}
%if 0%{?with_python3}
%exclude %{bashcompdir}/pip3*
%endif
%if 0%{?bashcomp2}
%dir %(dirname %{bashcompdir})
%endif

%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%files
%license LICENSE.txt
%doc README.rst docs
%{_bindir}/pip3
@ -327,7 +201,6 @@ py.test-%{python3_version} -m 'not network' @@ -327,7 +201,6 @@ py.test-%{python3_version} -m 'not network'
%if 0%{?bashcomp2}
%dir %(dirname %{bashcompdir})
%endif
%endif # with_python3

%changelog
* Fri May 04 2018 Miro Hrončok <mhroncok@redhat.com> - 9.0.3-2

Loading…
Cancel
Save