15
0
forked from pool/python-psutil

- update to 6.1.0:

* 2366_, [Windows]: drastically speedup `process_iter()`_. We
    now determine process unique identity by using process "fast"
    create time method. This will considerably speedup those apps
    which use `process_iter()`_ only once, e.g. to look for a
    process with a certain name.
  * 2446_: use pytest instead of unittest.
  * 2448_: add make install-sysdeps target to install the
    necessary system dependencies (python-dev, gcc, etc.) on all
    supported UNIX flavors.
  * 2449_: add make install-pydeps-test and make install-pydeps-
    dev targets. They can be used to install dependencies meant
    for running tests and for local development. They can also be
    installed via pip install .[test] and pip install .[dev].
  * 2456_: allow to run tests via python3 -m psutil.tests even if
    pytest module is not installed. This is useful for production
    environments that don't have pytest installed, but still want
    to be able to test psutil installation.
  * 2427_: psutil (segfault) on import in the free-threaded (no
    GIL) version of Python 3.13.  (patch by Sam Gross)
  * 2455_, [Linux]: IndexError may occur when reading
    /proc/pid/stat and field 40 (blkio_ticks) is missing.
  * 2457_, [AIX]: significantly improve the speed of
    `Process.open_files()`_ for some edge cases.
  * 2460_, [OpenBSD]: `Process.num_fds()`_ and
    `Process.open_files()`_ may fail with `NoSuchProcess`_ for
    PID 0. Instead, we now return "null" values (0 and []
    respectively).
- drop skip_failing_tests.patch: obsolete

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=175
This commit is contained in:
2024-11-20 16:23:42 +00:00
committed by Git OBS Bridge
commit 0fba780c66
10 changed files with 2108 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

34
mem-used-bsc1181475.patch Normal file
View File

@@ -0,0 +1,34 @@
---
psutil/_pslinux.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: psutil-5.9.5/psutil/_pslinux.py
===================================================================
--- psutil-5.9.5.orig/psutil/_pslinux.py
+++ psutil-5.9.5/psutil/_pslinux.py
@@ -474,12 +474,6 @@ def virtual_memory():
except KeyError:
slab = 0
- used = total - free - cached - buffers
- if used < 0:
- # May be symptomatic of running within a LCX container where such
- # values will be dramatically distorted over those of the host.
- used = total - free
-
# - starting from 4.4.0 we match free's "available" column.
# Before 4.4.0 we calculated it as (free + buffers + cached)
# which matched htop.
@@ -510,6 +504,12 @@ def virtual_memory():
# 24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c#L764
avail = free
+ used = total - avail
+ if used < 0:
+ # May be symptomatic of running within a LCX container where such
+ # values will be dramatically distorted over those of the host.
+ used = total - free
+
percent = usage_percent((total - avail), total, round_=1)
# Warn about missing metrics which are set to 0.

3
psutil-5.9.7.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f02134e82cfb5d089fddf20bb2e03fd5cd52395321d1c8458a9e58500ff417c
size 498429

BIN
psutil-6.0.0.tar.gz LFS Normal file

Binary file not shown.

3
psutil-6.1.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a
size 508565

1712
python-psutil.changes Normal file

File diff suppressed because it is too large Load Diff

90
python-psutil.spec Normal file
View File

@@ -0,0 +1,90 @@
#
# spec file for package python-psutil
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%ifarch x86_64 %{ix86}
%bcond_without test
%else
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-psutil
Version: 6.1.0
Release: 0
Summary: A process utilities module for Python
License: BSD-3-Clause
URL: https://github.com/giampaolo/psutil
Source: https://files.pythonhosted.org/packages/source/p/psutil/psutil-%{version}.tar.gz
# PATCH-FIX-SLE adopt change of used memory of procps
Patch4: mem-used-bsc1181475.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: procps
BuildRequires: pkgconfig(libsystemd)
%if %{with test}
%if 0%{?suse_version} > 1500
BuildRequires: /usr/bin/who
%endif
BuildRequires: net-tools
BuildRequires: procps
%endif
%python_subpackages
%description
A graphical interface that lets you easily analyze and introspect unaltered running Python processes.
%prep
%autosetup -p1 -n psutil-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python.*|#!%{__$python}|" {} \;
%fdupes %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
%fdupes %{buildroot}%{$python_sitearch}
}
%if %{with test}
%check
export LANG=en_US.UTF-8
export PSUTIL_TESTING=1
export PSUTIL_DEBUG=1
export PYTHONDONTRWRITEBYTECODE=1
mkdir testd
pushd testd
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -Wa -m psutil.tests
popd
%endif
%files %{python_files}
%license LICENSE
%doc CREDITS HISTORY.rst README.rst
%{_docdir}/%{python_prefix}-psutil/scripts/
%{python_sitearch}/psutil/
%exclude %{python_sitearch}/psutil/tests
%{python_sitearch}/psutil-%{version}.dist-info
%changelog

183
skip_failing_tests.patch Normal file
View File

@@ -0,0 +1,183 @@
diff -Nru psutil-6.0.0.orig/psutil/tests/test_contracts.py psutil-6.0.0/psutil/tests/test_contracts.py
--- psutil-6.0.0.orig/psutil/tests/test_contracts.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_contracts.py 2024-07-17 14:20:15.685789923 +0200
@@ -249,6 +249,7 @@
self.assertIsInstance(k, str)
self.assert_ntuple_of_nums(v, type_=(int, long))
+ @unittest.skip("Fails in OBS")
def test_disk_partitions(self):
# Duplicate of test_system.py. Keep it anyway.
for disk in psutil.disk_partitions():
diff -Nru psutil-6.0.0.orig/psutil/tests/test_linux.py psutil-6.0.0/psutil/tests/test_linux.py
--- psutil-6.0.0.orig/psutil/tests/test_linux.py 2024-06-18 23:00:36.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_linux.py 2024-07-17 14:20:15.685789923 +0200
@@ -756,6 +756,7 @@
self.assertEqual(psutil.cpu_count(logical=True), num)
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
+ @unittest.skip("Fails in OBS")
def test_against_lscpu(self):
out = sh("lscpu -p")
num = len([x for x in out.split('\n') if not x.startswith('#')])
@@ -801,6 +802,7 @@
@unittest.skipIf(not LINUX, "LINUX only")
class TestSystemCPUCountCores(PsutilTestCase):
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
+ @unittest.skip("Fails in OBS")
def test_against_lscpu(self):
out = sh("lscpu -p")
core_ids = set()
@@ -1196,6 +1198,7 @@
class TestSystemDiskPartitions(PsutilTestCase):
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
@skip_on_not_implemented()
+ @unittest.skip("Fails in OBS")
def test_against_df(self):
# test psutil.disk_usage() and psutil.disk_partitions()
# against "df -a"
@@ -1374,6 +1377,7 @@
self.assertEqual(ret.read_count, 1)
self.assertEqual(ret.write_count, 5)
+ @unittest.skip("Fails in OBS")
def test_emulate_use_sysfs(self):
def exists(path):
return path == '/proc/diskstats'
@@ -1417,6 +1421,7 @@
finder.ask_sys_class_block()
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
+ @unittest.skip("Fails in OBS")
def test_comparisons(self):
finder = RootFsDeviceFinder()
self.assertIsNotNone(finder.find())
@@ -1445,6 +1450,7 @@
findmnt_value = sh("findmnt -o SOURCE -rn /")
self.assertEqual(psutil_value, findmnt_value)
+ @unittest.skip("Fails in OBS")
def test_disk_partitions_mocked(self):
with mock.patch(
'psutil._pslinux.cext.disk_partitions',
@@ -1728,6 +1734,8 @@
self.assertIsNone(psutil.sensors_battery().power_plugged)
assert m.called
+ @unittest.skipUnless(os.path.exists('/sys/class/power_supply/BAT0/energy_full'),
+ 'Missing /sys/class/power_supply/BAT0/energy_full file.')
def test_emulate_energy_full_0(self):
# Emulate a case where energy_full files returns 0.
with mock_open_content(
@@ -1736,6 +1744,8 @@
self.assertEqual(psutil.sensors_battery().percent, 0)
assert m.called
+ @unittest.skipUnless(os.path.exists('/sys/class/power_supply/BAT0/energy_full'),
+ 'Missing /sys/class/power_supply/BAT0/energy_full file.')
def test_emulate_energy_full_not_avail(self):
# Emulate a case where energy_full file does not exist.
# Expected fallback on /capacity.
@@ -2324,6 +2334,7 @@
value = self.read_status_file("nonvoluntary_ctxt_switches:")
self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
+ @unittest.skip("Fails in certain OBS environments")
def test_cpu_affinity(self):
value = self.read_status_file("Cpus_allowed_list:")
if '-' in str(value):
diff -Nru psutil-6.0.0.orig/psutil/tests/test_misc.py psutil-6.0.0/psutil/tests/test_misc.py
--- psutil-6.0.0.orig/psutil/tests/test_misc.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_misc.py 2024-07-17 14:20:15.682456583 +0200
@@ -343,6 +343,7 @@
# # XXX: https://github.com/pypa/setuptools/pull/2896
# @unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
+ # @unittest.skip("Fails in OBS")
# def test_setup_script(self):
# setup_py = os.path.join(ROOT_DIR, 'setup.py')
# if CI_TESTING and not os.path.exists(setup_py):
@@ -966,6 +967,7 @@
src = f.read()
ast.parse(src)
+ @unittest.skip("Fails in OBS")
def test_coverage(self):
# make sure all example scripts have a test method defined
meths = dir(self)
@@ -987,6 +989,7 @@
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
raise self.fail('%r is not executable' % path)
+ @unittest.skip("Fails in OBS")
def test_disk_usage(self):
self.assert_stdout('disk_usage.py')
diff -Nru psutil-6.0.0.orig/psutil/tests/test_posix.py psutil-6.0.0/psutil/tests/test_posix.py
--- psutil-6.0.0.orig/psutil/tests/test_posix.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_posix.py 2024-07-17 14:20:15.685789923 +0200
@@ -443,6 +443,7 @@
# AIX can return '-' in df output instead of numbers, e.g. for /proc
@unittest.skipIf(AIX, "unreliable on AIX")
@retry_on_failure()
+ @unittest.skip("Fails in OBS")
def test_disk_usage(self):
def df(device):
try:
diff -Nru psutil-6.0.0.orig/psutil/tests/test_process_all.py psutil-6.0.0/psutil/tests/test_process_all.py
--- psutil-6.0.0.orig/psutil/tests/test_process_all.py 2024-06-18 23:00:36.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_process_all.py 2024-07-17 14:28:46.700089665 +0200
@@ -15,6 +15,7 @@
import stat
import time
import traceback
+import unittest
import psutil
from psutil import AIX
@@ -130,6 +131,7 @@
ls.append(proc_info(pid))
return ls
+ @unittest.skip("Fails in OBS")
def test_all(self):
failures = []
for info in self.iter_proc_info():
diff -Nru psutil-6.0.0.orig/psutil/tests/test_process.py psutil-6.0.0/psutil/tests/test_process.py
--- psutil-6.0.0.orig/psutil/tests/test_process.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_process.py 2024-07-17 14:20:15.685789923 +0200
@@ -360,6 +360,7 @@
@unittest.skipIf(not HAS_IONICE, "not supported")
@unittest.skipIf(not LINUX, "linux only")
+ @unittest.skip("Unreliable in OBS")
def test_ionice_linux(self):
def cleanup(init):
ioclass, value = init
diff -Nru psutil-6.0.0.orig/psutil/tests/test_system.py psutil-6.0.0/psutil/tests/test_system.py
--- psutil-6.0.0.orig/psutil/tests/test_system.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_system.py 2024-07-17 14:25:27.213045941 +0200
@@ -243,6 +243,7 @@
self.assertLess(bt, time.time())
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
+ @unittest.skip("Fails in OBS")
def test_users(self):
users = psutil.users()
self.assertNotEqual(users, [])
@@ -591,6 +592,7 @@
MACOS and platform.machine() == 'arm64', "skipped due to #1892"
)
@unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skip("Fails in OBS")
def test_cpu_freq(self):
def check_ls(ls):
for nt in ls:
@@ -662,6 +664,7 @@
def test_disk_usage_bytes(self):
psutil.disk_usage(b'.')
+ @unittest.skip("Fails in OBS")
def test_disk_partitions(self):
def check_ntuple(nt):
self.assertIsInstance(nt.device, str)

View File

@@ -0,0 +1,56 @@
---
psutil/tests/test_process.py | 6 ++++++
1 file changed, 6 insertions(+)
Index: psutil-5.9.6/psutil/tests/test_process.py
===================================================================
--- psutil-5.9.6.orig/psutil/tests/test_process.py
+++ psutil-5.9.6/psutil/tests/test_process.py
@@ -419,6 +419,7 @@ class TestProcess(PsutilTestCase):
p.ionice(init)
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_get(self):
import resource
p = psutil.Process(os.getpid())
@@ -442,6 +443,7 @@ class TestProcess(PsutilTestCase):
self.assertGreaterEqual(ret[1], -1)
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_set(self):
p = self.spawn_psproc()
p.rlimit(psutil.RLIMIT_NOFILE, (5, 5))
@@ -455,6 +457,7 @@ class TestProcess(PsutilTestCase):
p.rlimit(psutil.RLIMIT_NOFILE, (5, 5, 5))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit(self):
p = psutil.Process()
testfn = self.get_testfn()
@@ -475,6 +478,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(p.rlimit(psutil.RLIMIT_FSIZE), (soft, hard))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_infinity(self):
# First set a limit, then re-set it by specifying INFINITY
# and assume we overridden the previous limit.
@@ -490,6 +494,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(p.rlimit(psutil.RLIMIT_FSIZE), (soft, hard))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_infinity_value(self):
# RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really
# big number on a platform with large file support. On these
@@ -1303,6 +1308,7 @@ class TestProcess(PsutilTestCase):
assert_raises_nsp(fun, name)
@unittest.skipIf(not POSIX, 'POSIX only')
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_zombie_process(self):
parent, zombie = self.spawn_zombie()
self.assertProcessZombie(zombie)