[packages/python-psutil] - up to 2.1.3; build for python3, too
arekm
arekm at pld-linux.org
Thu Oct 23 15:00:20 CEST 2014
commit b5b42a7190afd1dad5d5351f402ab0215b2ce69f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 23 15:00:14 2014 +0200
- up to 2.1.3; build for python3, too
python-psutil.spec | 99 +++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 83 insertions(+), 16 deletions(-)
---
diff --git a/python-psutil.spec b/python-psutil.spec
index 19a1e66..ff65c78 100644
--- a/python-psutil.spec
+++ b/python-psutil.spec
@@ -1,21 +1,30 @@
#
# Conditional build:
%bcond_without tests # do not perform "make test"
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
%define module psutil
Summary: A cross-platform process and system utilities module for Python
Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona
Name: python-%{module}
-Version: 1.2.1
+Version: 2.1.3
Release: 1
License: BSD
Group: Development/Languages/Python
Source0: https://pypi.python.org/packages/source/p/psutil/%{module}-%{version}.tar.gz
-# Source0-md5: 80c3b251389771ab472e554e6c729c36
+# Source0-md5: 015a013c46bb9bc30b5c344f26dea0d3
URL: http://code.google.com/p/psutil/
+BuildRequires: rpm-pythonprov
+%if %{with python2}
BuildRequires: python-devel
BuildRequires: python-distribute
-BuildRequires: rpm-pythonprov
+%endif
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-distribute
+BuildRequires: python3-modules
+%endif
BuildRequires: rpmbuild(macros) >= 1.219
Requires: python-modules
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -32,37 +41,81 @@ oraz zużyciu systemu (procesor, dyski, pamięć, sieć) w przenośny
sposób używjąc Pythona. Implementuje wiele funkcjonalności oferowanych
przez narzędzia linii komend.
+%package -n python3-%{module}
+Summary: A cross-platform process and system utilities module for Python
+Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona
+Group: Libraries/Python
+Requires: python3-modules
+
+%description -n python3-%{module}
+Module providing an interface for retrieving information on all
+running processes and system utilization (CPU, disk, memory, network)
+in a portable way by using Python, implementing many functionalities
+offered by command line tools.
+
+%description -n python3-%{module} -l pl.UTF-8
+Module providing an interface for retrieving information on all
+running processes and system utilization (CPU, disk, memory, network)
+in a portable way by using Python, implementing many functionalities
+offered by command line tools.
+
%prep
%setup -q -n %{module}-%{version}
-
%build
+%if %{with python2}
CC="%{__cc}" \
-CFLAGS="%{rpmcflags}" \
-%{__python} setup.py build
+CFLAGS="%{rpmcppflags} %{rpmcflags}" \
+%{__python} setup.py build --build-base build-2
+%{?with_tests:export PYTHONPATH=$(pwd)/build-2; %{__python} setup.py test}
+%endif
-%{?with_tests:export PYTHONPATH=$(pwd); %{__python} setup.py test}
+%if %{with python3}
+CC="%{__cc}" \
+CFLAGS="%{rpmcppflags} %{rpmcflags}" \
+%{__python3} setup.py build --build-base build-3
+%{?with_tests:export PYTHONPATH=$(pwd)/build-3; %{__python3} setup.py test}
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install \
- --skip-build \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+%if %{with python2}
+%{__python} setup.py \
+ build --build-base build-2 \
+ install --skip-build \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
-%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
-%py_comp $RPM_BUILD_ROOT%{py_sitedir}
%py_postclean
+%endif
+
+%if %{with python3}
+%{__python3} setup.py \
+ build --build-base build-3 \
+ install --skip-build \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
+%endif
+
+%if %{with python2}
+install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+%endif
+%if %{with python3}
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
+ | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc CREDITS README
+%doc CREDITS README.rst HISTORY.rst
%{py_sitedir}/%{module}
%attr(755,root,root) %{py_sitedir}/_psutil_linux.so
@@ -72,3 +125,17 @@ rm -rf $RPM_BUILD_ROOT
%{py_sitedir}/%{module}-*.egg-info
%endif
%{_examplesdir}/%{name}-%{version}
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc CREDITS README.rst HISTORY.rst
+
+%{py3_sitedir}/%{module}
+%attr(755,root,root) %{py3_sitedir}/_psutil_linux.*.so
+%attr(755,root,root) %{py3_sitedir}/_psutil_posix.*.so
+
+%{py3_sitedir}/%{module}-%{version}-py*.egg-info
+%{_examplesdir}/python3-%{module}-%{version}
+%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-psutil.git/commitdiff/b5b42a7190afd1dad5d5351f402ab0215b2ce69f
More information about the pld-cvs-commit
mailing list