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