forked from pool/python-psutil
- Update to 6.1.1
* 2471_: use Vulture CLI tool to detect dead code.
* 2418_, [Linux]: fix race condition in case /proc/PID/stat does not exist, but
/proc/PID does, resulting in FileNotFoundError.
* 2470_, [Linux]: `users()`_ may return "localhost" instead of the actual IP
address of the user logged in.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=177
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal 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
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
34
mem-used-bsc1181475.patch
Normal file
34
mem-used-bsc1181475.patch
Normal 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
3
psutil-5.9.7.tar.gz
Normal 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
BIN
psutil-6.0.0.tar.gz
LFS
Normal file
Binary file not shown.
3
psutil-6.1.0.tar.gz
Normal file
3
psutil-6.1.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a
|
||||
size 508565
|
||||
BIN
psutil-6.1.1.tar.gz
LFS
Normal file
BIN
psutil-6.1.1.tar.gz
LFS
Normal file
Binary file not shown.
1722
python-psutil.changes
Normal file
1722
python-psutil.changes
Normal file
File diff suppressed because it is too large
Load Diff
90
python-psutil.spec
Normal file
90
python-psutil.spec
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# spec file for package python-psutil
|
||||
#
|
||||
# Copyright (c) 2025 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.1
|
||||
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
183
skip_failing_tests.patch
Normal 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)
|
||||
56
skip_rlimit_tests_on_python2.patch
Normal file
56
skip_rlimit_tests_on_python2.patch
Normal 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)
|
||||
Reference in New Issue
Block a user