Make this for Python 3.5 only

This commit is contained in:
Miro Hrončok 2014-06-07 15:25:12 +02:00
commit a89d58b356

View file

@ -1,23 +1,14 @@
%if (! 0%{?rhel}) || 0%{?rhel} > 6
%global with_python3 1
%global build_wheel 1
%endif
%if 0%{?rhel} && 0%{?rhel} < 6
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%global build_wheel 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
Name: python-%{srcname}
Name: python35-%{srcname}
Version: 1.5.6
Release: 1%{?dist}
Summary: A tool for installing and managing Python packages
Summary: A tool for installing and managing Python 3 packages
Group: Development/Libraries
License: MIT
@ -27,13 +18,13 @@ Patch0: pip-1.5rc1-allow-stripping-prefix-from-wheel-RECORD-files.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python35-devel
BuildRequires: python35-setuptools
%if 0%{?build_wheel}
BuildRequires: python-pip
BuildRequires: python-wheel
BuildRequires: python35-pip
BuildRequires: python35-wheel
%endif
Requires: python-setuptools
Requires: python35-setuptools
%description
Pip is a replacement for `easy_install
@ -41,27 +32,6 @@ Pip is a replacement for `easy_install
same techniques for finding packages, so packages that were made
easy_installable should be pip-installable as well.
%if 0%{?with_python3}
%package -n python3-pip
Summary: A tool for installing and managing Python3 packages
Group: Development/Libraries
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if 0%{?build_wheel}
BuildRequires: python3-pip
BuildRequires: python3-wheel
%endif
Requires: python3-setuptools
%description -n python3-pip
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
%setup -q -n %{srcname}-%{version}
@ -69,50 +39,25 @@ easy_installable should be pip-installable as well.
%{__sed} -i '1d' pip/__init__.py
%if 0%{?with_python3}
cp -a . %{py3dir}
%endif # with_python3
%build
%if 0%{?build_wheel}
%{__python} setup.py bdist_wheel
%{__python35} setup.py bdist_wheel
%else
%{__python} setup.py build
%{__python35} setup.py build
%endif
%if 0%{?with_python3}
pushd %{py3dir}
%if 0%{?build_wheel}
%{__python3} setup.py bdist_wheel
%else
%{__python3} setup.py build
%endif
popd
%endif # with_python3
%install
%{__rm} -rf %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%if 0%{?build_wheel}
pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
# 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)
%else
%{__python35} setup.py install --skip-build --root %{buildroot}
%endif
rm %{buildroot}%{_bindir}/pip
%else
%{__python3} setup.py install --skip-build --root %{buildroot}
%endif
%endif # with_python3
%if 0%{?build_wheel}
pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
%else
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
%endif
rm %{buildroot}%{_bindir}/pip3
%clean
%{__rm} -rf %{buildroot}
@ -123,17 +68,8 @@ pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefi
%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.rst docs
%attr(755,root,root) %{_bindir}/pip
%attr(755,root,root) %{_bindir}/pip2*
%{python_sitelib}/pip*
%if 0%{?with_python3}
%files -n python3-pip
%defattr(-,root,root,-)
%doc LICENSE.txt README.rst docs
%attr(755,root,root) %{_bindir}/pip3*
%{python3_sitelib}/pip*
%endif # with_python3
%{python35_sitelib}/pip*
%changelog
* Sun May 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.6-1