]>
Commit | Line | Data |
---|---|---|
fb9dc603 | 1 | # TODO: |
658986de | 2 | # - Fix tests (a few fail) |
52ca0973 | 3 | # |
02ee3b03 | 4 | # Conditional build: |
748d284f | 5 | %bcond_without doc # Sphinx documentation |
658986de | 6 | %bcond_with tests # unit tests |
748d284f JB |
7 | %bcond_without python2 # CPython 2.x module |
8 | %bcond_without python3 # CPython 3.x module | |
02ee3b03 | 9 | |
72bc27e5 | 10 | %define module psutil |
02ee3b03 MK |
11 | Summary: A cross-platform process and system utilities module for Python |
12 | Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona | |
13 | Name: python-%{module} | |
1cbe6543 | 14 | Version: 5.9.0 |
1bbffd2c | 15 | Release: 3 |
02ee3b03 MK |
16 | License: BSD |
17 | Group: Development/Languages/Python | |
658986de JB |
18 | #Source0Download: https://pypi.org/simple/psutil/ |
19 | Source0: https://github.com/giampaolo/psutil/archive/release-%{version}/%{module}-%{version}.tar.gz | |
1cbe6543 | 20 | # Source0-md5: 080d75a78be3ef1ce72c39a9b001197d |
72bc27e5 | 21 | URL: https://github.com/giampaolo/psutil |
b5b42a71 | 22 | BuildRequires: rpm-pythonprov |
52ca0973 | 23 | BuildRequires: rpmbuild(macros) >= 1.714 |
b5b42a71 | 24 | %if %{with python2} |
52ca0973 JB |
25 | BuildRequires: python-devel >= 1:2.6 |
26 | %if %{with tests} | |
658986de | 27 | BuildRequires: python-ipaddress |
79c2de42 | 28 | BuildRequires: python-mock |
52ca0973 JB |
29 | %if "%{py_ver}" < "2.7" |
30 | BuildRequires: python-unittest2 | |
31 | %endif | |
32 | %endif | |
b5b42a71 AM |
33 | %endif |
34 | %if %{with python3} | |
658986de JB |
35 | BuildRequires: python3-devel >= 1:3.4 |
36 | BuildRequires: python3-modules >= 1:3.4 | |
b5b42a71 | 37 | %endif |
52ca0973 | 38 | Requires: python-modules >= 1:2.6 |
02ee3b03 MK |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
40 | ||
41 | %description | |
42 | Module providing an interface for retrieving information on all | |
43 | running processes and system utilization (CPU, disk, memory, network) | |
44 | in a portable way by using Python, implementing many functionalities | |
45 | offered by command line tools. | |
46 | ||
47 | %description -l pl.UTF-8 | |
48 | Moduł dostarczający interfejs do informacji o działających procesach | |
49 | oraz zużyciu systemu (procesor, dyski, pamięć, sieć) w przenośny | |
50 | sposób używjąc Pythona. Implementuje wiele funkcjonalności oferowanych | |
51 | przez narzędzia linii komend. | |
52 | ||
b5b42a71 AM |
53 | %package -n python3-%{module} |
54 | Summary: A cross-platform process and system utilities module for Python | |
55 | Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona | |
56 | Group: Libraries/Python | |
658986de | 57 | Requires: python3-modules >= 1:3.4 |
b5b42a71 AM |
58 | |
59 | %description -n python3-%{module} | |
60 | Module providing an interface for retrieving information on all | |
61 | running processes and system utilization (CPU, disk, memory, network) | |
62 | in a portable way by using Python, implementing many functionalities | |
63 | offered by command line tools. | |
64 | ||
65 | %description -n python3-%{module} -l pl.UTF-8 | |
66 | Module providing an interface for retrieving information on all | |
67 | running processes and system utilization (CPU, disk, memory, network) | |
68 | in a portable way by using Python, implementing many functionalities | |
69 | offered by command line tools. | |
70 | ||
748d284f JB |
71 | %package apidocs |
72 | Summary: API documentation for Python psutil module | |
73 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona psutil | |
74 | Group: Documentation | |
75 | ||
76 | %description apidocs | |
77 | API documentation for Python psutil module. | |
78 | ||
79 | %description apidocs -l pl.UTF-8 | |
80 | Dokumentacja API modułu Pythona psutil. | |
81 | ||
02ee3b03 | 82 | %prep |
cfcf3673 | 83 | %setup -q -n %{module}-release-%{version} |
02ee3b03 | 84 | |
658986de JB |
85 | %if %{with tests} |
86 | # prepare subdir to run tests from | |
87 | # (cannot use topdir with PYTHONPATH=build-?/lib.* because python finds psutil dir without | |
88 | # _psutil_linux module inside in cwd before build-?/lib.*/psutil dir from PYTHONPATH) | |
89 | install -d tests | |
90 | ln -sf ../scripts tests | |
748d284f | 91 | ln -sf ../setup.py tests |
658986de JB |
92 | %endif |
93 | ||
02ee3b03 | 94 | %build |
b5b42a71 | 95 | %if %{with python2} |
28ffe788 | 96 | %py_build |
52ca0973 | 97 | |
658986de JB |
98 | %if %{with tests} |
99 | cd tests | |
100 | ln -snf ../build-2/lib.*/psutil psutil | |
101 | PYTHONPATH=$(pwd) \ | |
748d284f | 102 | %{__python} psutil/tests/__main__.py |
658986de JB |
103 | cd .. |
104 | %endif | |
b5b42a71 | 105 | %endif |
02ee3b03 | 106 | |
b5b42a71 | 107 | %if %{with python3} |
28ffe788 | 108 | %py3_build |
52ca0973 | 109 | |
658986de JB |
110 | %if %{with tests} |
111 | cd tests | |
112 | ln -snf ../build-3/lib.*/psutil psutil | |
113 | PYTHONPATH=$(pwd) \ | |
748d284f | 114 | %{__python3} psutil/tests/__main__.py |
658986de JB |
115 | cd .. |
116 | %endif | |
b5b42a71 | 117 | %endif |
02ee3b03 | 118 | |
748d284f JB |
119 | %if %{with doc} |
120 | %{__make} -C docs html \ | |
121 | SPHINXBUILD=sphinx-build-2 | |
122 | %endif | |
123 | ||
02ee3b03 MK |
124 | %install |
125 | rm -rf $RPM_BUILD_ROOT | |
02ee3b03 | 126 | |
b5b42a71 | 127 | %if %{with python2} |
28ffe788 | 128 | %py_install |
02ee3b03 | 129 | |
52ca0973 | 130 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/psutil/tests |
02ee3b03 | 131 | %py_postclean |
b5b42a71 AM |
132 | %endif |
133 | ||
134 | %if %{with python3} | |
28ffe788 | 135 | %py3_install |
52ca0973 JB |
136 | |
137 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/psutil/tests | |
b5b42a71 AM |
138 | %endif |
139 | ||
02ee3b03 MK |
140 | %clean |
141 | rm -rf $RPM_BUILD_ROOT | |
142 | ||
b5b42a71 | 143 | %if %{with python2} |
02ee3b03 MK |
144 | %files |
145 | %defattr(644,root,root,755) | |
eb891aca | 146 | %doc CREDITS HISTORY.rst LICENSE README.rst |
52ca0973 JB |
147 | %dir %{py_sitedir}/psutil |
148 | %attr(755,root,root) %{py_sitedir}/psutil/_psutil_linux.so | |
149 | %attr(755,root,root) %{py_sitedir}/psutil/_psutil_posix.so | |
150 | %{py_sitedir}/psutil/*.py[co] | |
151 | %{py_sitedir}/psutil-%{version}-py*.egg-info | |
b5b42a71 AM |
152 | %endif |
153 | ||
154 | %if %{with python3} | |
155 | %files -n python3-%{module} | |
156 | %defattr(644,root,root,755) | |
eb891aca | 157 | %doc CREDITS HISTORY.rst LICENSE README.rst |
52ca0973 JB |
158 | %dir %{py3_sitedir}/psutil |
159 | %attr(755,root,root) %{py3_sitedir}/psutil/_psutil_linux.*.so | |
160 | %attr(755,root,root) %{py3_sitedir}/psutil/_psutil_posix.*.so | |
161 | %{py3_sitedir}/psutil/*.py | |
162 | %{py3_sitedir}/psutil/__pycache__ | |
163 | %{py3_sitedir}/psutil-%{version}-py*.egg-info | |
b5b42a71 | 164 | %endif |
748d284f JB |
165 | |
166 | %if %{with doc} | |
167 | %files apidocs | |
168 | %defattr(644,root,root,755) | |
169 | %doc docs/_build/html/{_modules,_static,*.html,*.js} | |
170 | %endif |