From 748d284f7452915b9d3dc1286247717ad5b38209 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Mon, 30 Dec 2019 21:04:08 +0100 Subject: [PATCH] - updated to 5.6.7 - added linux patch (fix block dev stats reading on newer kernels) - added apidocs --- python-psutil-linux.patch | 10 ++++++++++ python-psutil.spec | 41 +++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 python-psutil-linux.patch diff --git a/python-psutil-linux.patch b/python-psutil-linux.patch new file mode 100644 index 0000000..ed53210 --- /dev/null +++ b/python-psutil-linux.patch @@ -0,0 +1,10 @@ +--- psutil-release-5.6.7/psutil/_pslinux.py.orig 2019-11-26 08:25:07.000000000 +0100 ++++ psutil-release-5.6.7/psutil/_pslinux.py 2019-12-30 19:25:22.441270337 +0100 +@@ -1107,6 +1107,7 @@ + with open_text(os.path.join(root, 'stat')) as f: + fields = f.read().strip().split() + name = os.path.basename(root) ++ del fields[11:] # newer kernels give more values + (reads, reads_merged, rbytes, rtime, writes, writes_merged, + wbytes, wtime, _, busy_time, _) = map(int, fields) + yield (name, reads, writes, rbytes, wbytes, rtime, diff --git a/python-psutil.spec b/python-psutil.spec index d98f561..7b62f9d 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -2,21 +2,23 @@ # - Fix tests (a few fail) # # Conditional build: +%bcond_without doc # Sphinx documentation %bcond_with tests # unit tests -%bcond_without python2 # CPython 2.x module -%bcond_without python3 # CPython 3.x module +%bcond_without python2 # CPython 2.x module +%bcond_without python3 # CPython 3.x module %define module psutil Summary: A cross-platform process and system utilities module for Python Summary(pl.UTF-8): Wieloplatformowe narzędzia do procesów i systemu dla Pythona Name: python-%{module} -Version: 5.6.3 -Release: 2 +Version: 5.6.7 +Release: 1 License: BSD Group: Development/Languages/Python #Source0Download: https://pypi.org/simple/psutil/ Source0: https://github.com/giampaolo/psutil/archive/release-%{version}/%{module}-%{version}.tar.gz -# Source0-md5: a94e4626ed31727b9bca12923dbda692 +# Source0-md5: 5cc1fca56cf433a68a729a8c524f7b0e +Patch0: %{name}-linux.patch URL: https://github.com/giampaolo/psutil BuildRequires: rpm-pythonprov BuildRequires: rpmbuild(macros) >= 1.714 @@ -67,8 +69,20 @@ running processes and system utilization (CPU, disk, memory, network) in a portable way by using Python, implementing many functionalities offered by command line tools. +%package apidocs +Summary: API documentation for Python psutil module +Summary(pl.UTF-8): Dokumentacja API modułu Pythona psutil +Group: Documentation + +%description apidocs +API documentation for Python psutil module. + +%description apidocs -l pl.UTF-8 +Dokumentacja API modułu Pythona psutil. + %prep %setup -q -n %{module}-release-%{version} +%patch0 -p1 %if %{with tests} # prepare subdir to run tests from @@ -76,18 +90,18 @@ offered by command line tools. # _psutil_linux module inside in cwd before build-?/lib.*/psutil dir from PYTHONPATH) install -d tests ln -sf ../scripts tests +ln -sf ../setup.py tests %endif %build %if %{with python2} %py_build -# "test" target causes endless loop, so... %if %{with tests} cd tests ln -snf ../build-2/lib.*/psutil psutil PYTHONPATH=$(pwd) \ -%{__python} -m psutil.tests +%{__python} psutil/tests/__main__.py cd .. %endif %endif @@ -99,11 +113,16 @@ cd .. cd tests ln -snf ../build-3/lib.*/psutil psutil PYTHONPATH=$(pwd) \ -%{__python3} -m psutil.tests +%{__python3} psutil/tests/__main__.py cd .. %endif %endif +%if %{with doc} +%{__make} -C docs html \ + SPHINXBUILD=sphinx-build-2 +%endif + %install rm -rf $RPM_BUILD_ROOT @@ -145,3 +164,9 @@ rm -rf $RPM_BUILD_ROOT %{py3_sitedir}/psutil/__pycache__ %{py3_sitedir}/psutil-%{version}-py*.egg-info %endif + +%if %{with doc} +%files apidocs +%defattr(644,root,root,755) +%doc docs/_build/html/{_modules,_static,*.html,*.js} +%endif -- 2.44.0