%bcond_without python2 %global srcname pip %global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl %global python_wheeldir %{_datadir}/python-wheels %global _description \ pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes. %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) Name: python-%{srcname} Version: 18.0 Release: 9 Summary: A tool for installing and managing Python packages License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) URL: http://www.pip-installer.org Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz BuildArch: noarch Patch0: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch1: remove-existing-dist-only-if-path-conflicts.patch Patch2: emit-a-warning-when-running-with-root-privileges.patch Patch6000: dummy-certifi.patch Source1: pip-allow-older-versions.patch %description %{_description} %if %{with python2} %package -n python2-%{srcname} Summary: %{summary} BuildRequires: python2-devel python2-setuptools ca-certificates Requires: python2-setuptools ca-certificates BuildRequires: python2-pip python2-wheel Provides: %{name}-wheel = %{version}-%{release} Obsoletes: %{name}-wheel < %{version}-%{release} %{?python_provide:%python_provide python2-%{srcname}} %description -n python2-%{srcname} %{_description} %endif %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools bash-completion ca-certificates Requires: python%{python3_pkgversion}-setuptools ca-certificates BuildRequires: python%{python3_pkgversion}-pip python%{python3_pkgversion}-wheel Provides: %{name}-wheel = %{version}-%{release} Obsoletes: %{name}-wheel < %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} %description -n python%{python3_pkgversion}-%{srcname} %{_description} %package_help %prep %autosetup -n %{srcname}-%{version} -p1 %build %if %{with python2} %py2_build %endif %py3_build_wheel %install %py3_install_wheel %{python_wheelname} rm %{buildroot}%{_bindir}/pip %if %{with python2} %py2_install_wheel %{python_wheelname} %endif for PIP in %{buildroot}%{_bindir}/pip*; do patch -p1 $PIP < %{SOURCE1} done mkdir -p %{buildroot}%{bashcompdir} %if %{with python2} PYTHONPATH=%{buildroot}%{python2_sitelib} \ %{buildroot}%{_bindir}/pip completion --bash \ > %{buildroot}%{bashcompdir}/pip %endif PYTHONPATH=%{buildroot}%{python3_sitelib} \ %{buildroot}%{_bindir}/pip3 completion --bash \ > %{buildroot}%{bashcompdir}/pip3 pips2=pip pips3=pip3 for pip in %{buildroot}%{_bindir}/pip*; do pip=$(basename $pip) case $pip in %if %{with python2} pip2*) pips2="$pips2 $pip" ln -s pip %{buildroot}%{bashcompdir}/$pip ;; %endif pip3?*) pips3="$pips3 $pip" ln -s pip3 %{buildroot}%{bashcompdir}/$pip ;; esac done sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \ -e s/_pip_completion/_pip3_completion/ \ %{buildroot}%{bashcompdir}/pip3 %if %{with python2} sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \ %{buildroot}%{bashcompdir}/pip %endif %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} install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %if %{with python2} %files -n python2-%{srcname} %license LICENSE.txt %{_bindir}/pip %{_bindir}/pip2 %{_bindir}/pip%{python2_version} %{python2_sitelib}/pip* %dir %{bashcompdir} %{bashcompdir}/pip %{bashcompdir}/pip2* %dir %(dirname %{bashcompdir}) %dir %{python_wheeldir}/ %{python_wheeldir}/%{python_wheelname} %endif %files -n python%{python3_pkgversion}-%{srcname} %license LICENSE.txt %{_bindir}/pip3 %{_bindir}/pip%{python3_version} %{python3_sitelib}/pip* %dir %{bashcompdir} %{bashcompdir}/pip3* %dir %(dirname %{bashcompdir}) %dir %{python_wheeldir}/ %{python_wheeldir}/%{python_wheelname} %files help %doc README.rst %changelog * Sun Sep 29 2019 yefei - 18.0-9 - Type:enhancement - ID:NA - SUG:NA - DESC: Synchronize patches * Sat Sep 28 2019 yefei - 18.0-8 - Type:enhancement - ID:NA - SUG:NA - DESC: add bash completion and repair python2 interpreter path * Wed Sep 25 2019 openEuler Buildteam - 18.0-7 - Type:enhancement - ID:NA - SUG:NA - DESC: Synchronize a patch * Mon Sep 23 2019 openEuler Buildteam - 18.0-6 - Package init