]>
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 |
078fe790 | 12 | Release: 3 |
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 | |
02ee3b03 MK |
28 | BuildRequires: rpmbuild(macros) >= 1.219 |
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 AM |
68 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ |
69 | %{__python} setup.py build --build-base build-2 | |
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}" \ | |
76 | %{__python3} setup.py build --build-base build-3 | |
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 AM |
83 | %if %{with python2} |
84 | %{__python} setup.py \ | |
85 | build --build-base build-2 \ | |
86 | install --skip-build \ | |
87 | --optimize=2 \ | |
88 | --root=$RPM_BUILD_ROOT | |
02ee3b03 | 89 | |
02ee3b03 | 90 | %py_postclean |
b5b42a71 AM |
91 | %endif |
92 | ||
93 | %if %{with python3} | |
94 | %{__python3} setup.py \ | |
95 | build --build-base build-3 \ | |
96 | install --skip-build \ | |
97 | --optimize=2 \ | |
98 | --root=$RPM_BUILD_ROOT | |
99 | %endif | |
100 | ||
101 | %if %{with python2} | |
102 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
103 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
104 | %endif | |
105 | %if %{with python3} | |
106 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
107 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
108 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
109 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
110 | %endif | |
02ee3b03 MK |
111 | |
112 | %clean | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
b5b42a71 | 115 | %if %{with python2} |
02ee3b03 MK |
116 | %files |
117 | %defattr(644,root,root,755) | |
b5b42a71 | 118 | %doc CREDITS README.rst HISTORY.rst |
02ee3b03 | 119 | |
0a81eebb AM |
120 | %dir %{py_sitedir}/%{module} |
121 | %{py_sitedir}/%{module}/*.py* | |
122 | %attr(755,root,root) %{py_sitedir}/%{module}/_psutil_linux.so | |
123 | %attr(755,root,root) %{py_sitedir}/%{module}/_psutil_posix.so | |
02ee3b03 MK |
124 | |
125 | %if "%{py_ver}" > "2.4" | |
126 | %{py_sitedir}/%{module}-*.egg-info | |
127 | %endif | |
128 | %{_examplesdir}/%{name}-%{version} | |
b5b42a71 AM |
129 | %endif |
130 | ||
131 | %if %{with python3} | |
132 | %files -n python3-%{module} | |
133 | %defattr(644,root,root,755) | |
134 | %doc CREDITS README.rst HISTORY.rst | |
135 | ||
0a81eebb AM |
136 | %dir %{py3_sitedir}/%{module} |
137 | %{py3_sitedir}/%{module}/*.py | |
138 | %{py3_sitedir}/%{module}/__pycache__ | |
139 | %attr(755,root,root) %{py3_sitedir}/%{module}/_psutil_linux.*.so | |
140 | %attr(755,root,root) %{py3_sitedir}/%{module}/_psutil_posix.*.so | |
b5b42a71 AM |
141 | |
142 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
143 | %{_examplesdir}/python3-%{module}-%{version} | |
144 | %endif |