[packages/python-pip] use py_build/py_install and keep standard executables

jajcus jajcus at pld-linux.org
Wed Nov 25 21:04:56 CET 2015


commit 3d0f9f1a29bb70aae2d3bc6e9496ee1b2b67007c
Author: Jacek Konieczny <jajcus at jajcus.net>
Date:   Wed Nov 25 21:03:58 2015 +0100

    use py_build/py_install and keep standard executables
    
    pipX.Y are standard command names described, we shoud keep them

 python-pip.spec | 57 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/python-pip.spec b/python-pip.spec
index ac00e16..37222b3 100644
--- a/python-pip.spec
+++ b/python-pip.spec
@@ -6,30 +6,46 @@
 #   site-packages/pip/_vendor/distlib/w64.exe
 #
 # Conditional build:
+%bcond_without	python2 # CPython 3.x module
 %bcond_without	python3 # CPython 3.x module
 %bcond_without	apidocs	# Sphinx documentation
+%bcond_with	tests	# do not perform tests (not included)
 
 %define 	module	pip
 Summary:	A tool for installing and managing Python 2 packages
 Summary(pl.UTF-8):	Narzędzie do instalowania i zarządzania pakietami Pythona 2
 Name:		python-%{module}
 Version:	7.1.2
-Release:	1
+Release:	2
 License:	MIT
 Group:		Development/Libraries
 # Source0Download: https://pypi.python.org/pypi/pip
 Source0:	http://pypi.python.org/packages/source/p/pip/%{module}-%{version}.tar.gz
 # Source0-md5:	3823d2343d9f3aaab21cf9c917710196
 URL:		https://pip.pypa.io/
+%if %{with python2}
 BuildRequires:	python-devel >= 1:2.6
 BuildRequires:	python-modules >= 1:2.6
 BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-pytest
+BuildRequires:	python-virtualenv >= 1.10
+BuildRequires:	python-scripttest >= 1.3
+BuildRequires:	python-mock
+%endif
+%endif
 BuildRequires:	rpm-pythonprov
 %{?with_apidocs:BuildRequires:	sphinx-pdg}
 %if %{with python3}
 BuildRequires:	python3-devel >= 1:3.2
 BuildRequires:	python3-modules >= 1:3.2
 BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-pytest
+BuildRequires:	python3-virtualenv >= 1.10
+BuildRequires:	python3-scripttest >= 1.3
+BuildRequires:	python3-mock
+%endif
 %endif
 Requires:	python-setuptools
 BuildArch:	noarch
@@ -80,72 +96,59 @@ Dokumentacja instalatora i modułów Pythona pip.
 # remove unneeded shebang
 %{__sed} -i '1d' pip/__init__.py
 
-%if %{with python3}
-set -- *
-install -d py3
-cp -a "$@" py3
-%endif
-
 %build
-%{__python} setup.py build
+%if %{with python2}
+%py_build %{?with_tests:test}
+%endif
 
 %if %{with apidocs}
 %{__make} -C docs html
 %endif
 
 %if %{with python3}
-cd py3
-%{__python3} setup.py build
+%py3_build %{?with_tests:test}
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
 %if %{with python3}
-cd py3
-%{__python3} setup.py install \
-	--optimize=2 \
-	--skip-build \
-	--root $RPM_BUILD_ROOT
-
-# remove pip3.x, keep just pip3
-%{__rm} $RPM_BUILD_ROOT%{_bindir}/pip%{py3_ver}
+%py3_install
 
 # RH compatibility
 ln -sf pip3 $RPM_BUILD_ROOT%{_bindir}/python3-pip
-cd -
 %endif
 
-%{__python} setup.py install \
-	--optimize=2 \
-	--skip-build \
-	--root $RPM_BUILD_ROOT
+%if %{with python2}
+%py_install
 
 %py_postclean
 
-# remove pip2.x, keep just pip2
-%{__rm} $RPM_BUILD_ROOT%{_bindir}/pip%{py_ver}
-
 # RH compatibility
-ln -sf pip $RPM_BUILD_ROOT%{_bindir}/python-pip
+ln -sf pip2 $RPM_BUILD_ROOT%{_bindir}/python-pip
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS.txt CHANGES.txt LICENSE.txt README.rst
 %attr(755,root,root) %{_bindir}/pip
 %attr(755,root,root) %{_bindir}/pip2
+%attr(755,root,root) %{_bindir}/pip2.*
 %attr(755,root,root) %{_bindir}/python-pip
 %{py_sitescriptdir}/pip-%{version}-py*.egg-info
 %{py_sitescriptdir}/pip
+%endif
 
 %if %{with python3}
 %files -n python3-pip
 %defattr(644,root,root,755)
 %doc AUTHORS.txt CHANGES.txt LICENSE.txt README.rst
 %attr(755,root,root) %{_bindir}/pip3
+%attr(755,root,root) %{_bindir}/pip3.*
 %attr(755,root,root) %{_bindir}/python3-pip
 %{py3_sitescriptdir}/pip
 %{py3_sitescriptdir}/pip-%{version}-py*.egg-info
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pip.git/commitdiff/3d0f9f1a29bb70aae2d3bc6e9496ee1b2b67007c



More information about the pld-cvs-commit mailing list