]>
Commit | Line | Data |
---|---|---|
02ee3b03 MK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
b5b42a71 AM |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
02ee3b03 MK |
6 | |
7 | %define module psutil | |
8 | Summary: A cross-platform process and system utilities module for Python | |
9 | Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona | |
10 | Name: python-%{module} | |
0a81eebb | 11 | Version: 3.0.1 |
b8039469 | 12 | Release: 4 |
02ee3b03 MK |
13 | License: BSD |
14 | Group: Development/Languages/Python | |
fba9537b | 15 | Source0: https://pypi.python.org/packages/source/p/psutil/%{module}-%{version}.tar.gz |
0a81eebb | 16 | # Source0-md5: 037dc67b7902d10f49f6fa5404a73a24 |
02ee3b03 | 17 | URL: http://code.google.com/p/psutil/ |
b5b42a71 AM |
18 | BuildRequires: rpm-pythonprov |
19 | %if %{with python2} | |
02ee3b03 MK |
20 | BuildRequires: python-devel |
21 | BuildRequires: python-distribute | |
b5b42a71 AM |
22 | %endif |
23 | %if %{with python3} | |
24 | BuildRequires: python3-devel | |
25 | BuildRequires: python3-distribute | |
26 | BuildRequires: python3-modules | |
27 | %endif | |
7fbc6e55 | 28 | BuildRequires: rpmbuild(macros) >= 1.710 |
02ee3b03 MK |
29 | Requires: python-modules |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
32 | %description | |
33 | Module providing an interface for retrieving information on all | |
34 | running processes and system utilization (CPU, disk, memory, network) | |
35 | in a portable way by using Python, implementing many functionalities | |
36 | offered by command line tools. | |
37 | ||
38 | %description -l pl.UTF-8 | |
39 | Moduł dostarczający interfejs do informacji o działających procesach | |
40 | oraz zużyciu systemu (procesor, dyski, pamięć, sieć) w przenośny | |
41 | sposób używjąc Pythona. Implementuje wiele funkcjonalności oferowanych | |
42 | przez narzędzia linii komend. | |
43 | ||
b5b42a71 AM |
44 | %package -n python3-%{module} |
45 | Summary: A cross-platform process and system utilities module for Python | |
46 | Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona | |
47 | Group: Libraries/Python | |
48 | Requires: python3-modules | |
49 | ||
50 | %description -n python3-%{module} | |
51 | Module providing an interface for retrieving information on all | |
52 | running processes and system utilization (CPU, disk, memory, network) | |
53 | in a portable way by using Python, implementing many functionalities | |
54 | offered by command line tools. | |
55 | ||
56 | %description -n python3-%{module} -l pl.UTF-8 | |
57 | Module providing an interface for retrieving information on all | |
58 | running processes and system utilization (CPU, disk, memory, network) | |
59 | in a portable way by using Python, implementing many functionalities | |
60 | offered by command line tools. | |
61 | ||
02ee3b03 MK |
62 | %prep |
63 | %setup -q -n %{module}-%{version} | |
64 | ||
02ee3b03 | 65 | %build |
b5b42a71 | 66 | %if %{with python2} |
02ee3b03 | 67 | CC="%{__cc}" \ |
b5b42a71 | 68 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ |
28ffe788 | 69 | %py_build |
b5b42a71 AM |
70 | %{?with_tests:export PYTHONPATH=$(pwd)/build-2; %{__python} setup.py test} |
71 | %endif | |
02ee3b03 | 72 | |
b5b42a71 AM |
73 | %if %{with python3} |
74 | CC="%{__cc}" \ | |
75 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ | |
28ffe788 | 76 | %py3_build |
b5b42a71 AM |
77 | %{?with_tests:export PYTHONPATH=$(pwd)/build-3; %{__python3} setup.py test} |
78 | %endif | |
02ee3b03 MK |
79 | |
80 | %install | |
81 | rm -rf $RPM_BUILD_ROOT | |
02ee3b03 | 82 | |
b5b42a71 | 83 | %if %{with python2} |
28ffe788 | 84 | %py_install |
02ee3b03 | 85 | |
02ee3b03 | 86 | %py_postclean |
b5b42a71 AM |
87 | %endif |
88 | ||
89 | %if %{with python3} | |
28ffe788 | 90 | %py3_install |
b5b42a71 AM |
91 | %endif |
92 | ||
93 | %if %{with python2} | |
94 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
95 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
96 | %endif | |
97 | %if %{with python3} | |
98 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
99 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
100 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
101 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
102 | %endif | |
02ee3b03 MK |
103 | |
104 | %clean | |
105 | rm -rf $RPM_BUILD_ROOT | |
106 | ||
b5b42a71 | 107 | %if %{with python2} |
02ee3b03 MK |
108 | %files |
109 | %defattr(644,root,root,755) | |
b5b42a71 | 110 | %doc CREDITS README.rst HISTORY.rst |
02ee3b03 | 111 | |
0a81eebb AM |
112 | %dir %{py_sitedir}/%{module} |
113 | %{py_sitedir}/%{module}/*.py* | |
114 | %attr(755,root,root) %{py_sitedir}/%{module}/_psutil_linux.so | |
115 | %attr(755,root,root) %{py_sitedir}/%{module}/_psutil_posix.so | |
02ee3b03 MK |
116 | |
117 | %if "%{py_ver}" > "2.4" | |
118 | %{py_sitedir}/%{module}-*.egg-info | |
119 | %endif | |
120 | %{_examplesdir}/%{name}-%{version} | |
b5b42a71 AM |
121 | %endif |
122 | ||
123 | %if %{with python3} | |
124 | %files -n python3-%{module} | |
125 | %defattr(644,root,root,755) | |
126 | %doc CREDITS README.rst HISTORY.rst | |
127 | ||
0a81eebb AM |
128 | %dir %{py3_sitedir}/%{module} |
129 | %{py3_sitedir}/%{module}/*.py | |
130 | %{py3_sitedir}/%{module}/__pycache__ | |
131 | %attr(755,root,root) %{py3_sitedir}/%{module}/_psutil_linux.*.so | |
132 | %attr(755,root,root) %{py3_sitedir}/%{module}/_psutil_posix.*.so | |
b5b42a71 AM |
133 | |
134 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
135 | %{_examplesdir}/python3-%{module}-%{version} | |
136 | %endif |