python-pip/python-pip.spec

180 lines
5.2 KiB
RPMSpec
Raw Normal View History

2019-09-30 11:15:19 -04:00
%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
2019-12-13 16:04:24 +08:00
Release: 11
2019-09-30 11:15:19 -04:00
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}
2019-12-13 16:04:24 +08:00
Summary: %{summary}
2019-09-30 11:15:19 -04:00
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
2019-12-13 16:04:24 +08:00
%package wheel
Summary: The pip wheel
Requires: ca-certificates
%description wheel
A Python wheel of pip to use with venv
2019-09-30 11:15:19 -04:00
%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})
%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})
%files help
%doc README.rst
2019-12-13 16:04:24 +08:00
%files wheel
%license LICENSE.txt
%dir %{python_wheeldir}/
%{python_wheeldir}/%{python_wheelname}
2019-09-30 11:15:19 -04:00
%changelog
2019-12-13 16:04:24 +08:00
* Sat Nov 16 2019 huzhiyu <huzhiyu1@huawei.com> - 18.0-11
- fix ca-certificate bad requires
* Fri Oct 15 2019 lvying<lvying6@huawei.com> - 18.0-10
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: split same wheel file from python2-pip and python3-pip
2019-09-30 11:15:19 -04:00
* Sun Sep 29 2019 yefei <yefei25@huawei.com> - 18.0-9
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: Synchronize patches
* Sat Sep 28 2019 yefei <yefei25@huawei.com> - 18.0-8
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: add bash completion and repair python2 interpreter path
* Wed Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 18.0-7
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: Synchronize a patch
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 18.0-6
- Package init