]>
Commit | Line | Data |
---|---|---|
1 | # TODO: | |
2 | # - Fix tests (a few fail) | |
3 | # | |
4 | # Conditional build: | |
5 | %bcond_with tests # unit tests | |
6 | %bcond_without python2 # CPython 2.x module | |
7 | %bcond_without python3 # CPython 3.x module | |
8 | ||
9 | %define module psutil | |
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} | |
13 | Version: 5.4.8 | |
14 | Release: 1 | |
15 | License: BSD | |
16 | Group: Development/Languages/Python | |
17 | #Source0Download: https://pypi.org/simple/psutil/ | |
18 | Source0: https://github.com/giampaolo/psutil/archive/release-%{version}/%{module}-%{version}.tar.gz | |
19 | # Source0-md5: 27a34a9aba8bec93cc0927647999b400 | |
20 | URL: https://github.com/giampaolo/psutil | |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-devel >= 1:2.6 | |
25 | %if %{with tests} | |
26 | BuildRequires: python-ipaddress | |
27 | BuildRequires: python-mock | |
28 | %if "%{py_ver}" < "2.7" | |
29 | BuildRequires: python-unittest2 | |
30 | %endif | |
31 | %endif | |
32 | %endif | |
33 | %if %{with python3} | |
34 | BuildRequires: python3-devel >= 1:3.4 | |
35 | BuildRequires: python3-modules >= 1:3.4 | |
36 | %endif | |
37 | Requires: python-modules >= 1:2.6 | |
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 | ||
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 | |
56 | Requires: python3-modules >= 1:3.4 | |
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 | ||
70 | %prep | |
71 | %setup -q -n %{module}-release-%{version} | |
72 | ||
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 | ||
81 | %build | |
82 | %if %{with python2} | |
83 | %py_build | |
84 | # "test" target causes endless loop, so... | |
85 | ||
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 | |
93 | %endif | |
94 | ||
95 | %if %{with python3} | |
96 | %py3_build | |
97 | ||
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 | |
105 | %endif | |
106 | ||
107 | %install | |
108 | rm -rf $RPM_BUILD_ROOT | |
109 | ||
110 | %if %{with python2} | |
111 | %py_install | |
112 | ||
113 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/psutil/tests | |
114 | %py_postclean | |
115 | %endif | |
116 | ||
117 | %if %{with python3} | |
118 | %py3_install | |
119 | ||
120 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/psutil/tests | |
121 | %endif | |
122 | ||
123 | %clean | |
124 | rm -rf $RPM_BUILD_ROOT | |
125 | ||
126 | %if %{with python2} | |
127 | %files | |
128 | %defattr(644,root,root,755) | |
129 | %doc CREDITS HISTORY.rst IDEAS LICENSE README.rst | |
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 | |
135 | %endif | |
136 | ||
137 | %if %{with python3} | |
138 | %files -n python3-%{module} | |
139 | %defattr(644,root,root,755) | |
140 | %doc CREDITS HISTORY.rst IDEAS LICENSE README.rst | |
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 | |
147 | %endif |