- update to 5.9.5:

* in case of exception, display a cleaner error
    traceback by hiding the `KeyError` bit deriving from a
    missed cache hit.
  * print the full traceback when a `DeprecationWarning`
    or `UserWarning` is raised.
  * there are cases where `Process.cwd()`_ cannot be
    determined (e.g. directory no longer exists), in which case
    we returned either ``None`` or an empty string. 
    This was consolidated and we now return ``""`` on all
    platforms.
  * [UNIX]: if process is a zombie, and we can only
    determine part of the its truncated `Process.name()`_
    (15 chars), don't fail with `ZombieProcess`_ when we try
    to guess the full name from the `Process.cmdline()`_. Just
    return the truncated name.
  * on certain kernels, ``"MemAvailable"`` field
    from ``/proc/meminfo`` returns ``0`` (possibly a kernel bug), in
    which case we calculate an approximation for ``available``
    memory which matches "free" CLI utility.
  * `disk_partitions()`_: do not unnecessarily
    read /proc/filesystems and raise `AccessDenied`_ unless user
    specified `all=False` argument.
  * `users()`_ loses precision for ``started``
    attribute (off by 1 minute).
  * if cwd no longer exists. Return an empty string instead.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=156
This commit is contained in:
Dirk Mueller 2023-05-03 09:07:06 +00:00 committed by Git OBS Bridge
parent a85caf59d0
commit ee06b25cd4
6 changed files with 80 additions and 48 deletions

View File

@ -2,9 +2,11 @@
psutil/_pslinux.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py 2022-06-23 09:43:10.973822573 +0000
@@ -473,12 +473,6 @@ def virtual_memory():
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
@ -17,8 +19,8 @@
# - 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.
@@ -503,6 +497,12 @@ def virtual_memory():
if avail > total:
@@ -510,6 +504,12 @@ def virtual_memory():
# 24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c#L764
avail = free
+ used = total - avail

View File

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

BIN
psutil-5.9.5.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Wed May 3 09:04:54 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 5.9.5:
* in case of exception, display a cleaner error
traceback by hiding the `KeyError` bit deriving from a
missed cache hit.
* print the full traceback when a `DeprecationWarning`
or `UserWarning` is raised.
* there are cases where `Process.cwd()`_ cannot be
determined (e.g. directory no longer exists), in which case
we returned either ``None`` or an empty string.
This was consolidated and we now return ``""`` on all
platforms.
* [UNIX]: if process is a zombie, and we can only
determine part of the its truncated `Process.name()`_
(15 chars), don't fail with `ZombieProcess`_ when we try
to guess the full name from the `Process.cmdline()`_. Just
return the truncated name.
* on certain kernels, ``"MemAvailable"`` field
from ``/proc/meminfo`` returns ``0`` (possibly a kernel bug), in
which case we calculate an approximation for ``available``
memory which matches "free" CLI utility.
* `disk_partitions()`_: do not unnecessarily
read /proc/filesystems and raise `AccessDenied`_ unless user
specified `all=False` argument.
* `users()`_ loses precision for ``started``
attribute (off by 1 minute).
* if cwd no longer exists. Return an empty string instead.
-------------------------------------------------------------------
Fri Apr 21 12:29:57 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -25,7 +25,7 @@
%bcond_without python2
%{?sle15_python_module_pythons}
Name: python-psutil
Version: 5.9.4
Version: 5.9.5
Release: 0
Summary: A process utilities module for Python
License: BSD-3-Clause

View File

@ -1,16 +1,16 @@
Index: psutil-5.9.4/psutil/tests/test_misc.py
Index: psutil-5.9.5/psutil/tests/test_misc.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_misc.py
+++ psutil-5.9.4/psutil/tests/test_misc.py
@@ -252,6 +252,7 @@ class TestMisc(PsutilTestCase):
--- psutil-5.9.5.orig/psutil/tests/test_misc.py
+++ psutil-5.9.5/psutil/tests/test_misc.py
@@ -251,6 +251,7 @@ class TestMisc(PsutilTestCase):
# 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):
@@ -745,6 +746,7 @@ class TestScripts(PsutilTestCase):
# # 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):
@@ -847,6 +848,7 @@ class TestScripts(PsutilTestCase):
src = f.read()
ast.parse(src)
@ -18,7 +18,7 @@ Index: psutil-5.9.4/psutil/tests/test_misc.py
def test_coverage(self):
# make sure all example scripts have a test method defined
meths = dir(self)
@@ -764,6 +766,7 @@ class TestScripts(PsutilTestCase):
@@ -866,6 +868,7 @@ class TestScripts(PsutilTestCase):
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
raise self.fail('%r is not executable' % path)
@ -26,11 +26,11 @@ Index: psutil-5.9.4/psutil/tests/test_misc.py
def test_disk_usage(self):
self.assert_stdout('disk_usage.py')
Index: psutil-5.9.4/psutil/tests/test_linux.py
Index: psutil-5.9.5/psutil/tests/test_linux.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_linux.py
+++ psutil-5.9.4/psutil/tests/test_linux.py
@@ -688,6 +688,7 @@ class TestSystemCPUCountLogical(PsutilTe
--- psutil-5.9.5.orig/psutil/tests/test_linux.py
+++ psutil-5.9.5/psutil/tests/test_linux.py
@@ -713,6 +713,7 @@ class TestSystemCPUCountLogical(PsutilTe
self.assertEqual(psutil.cpu_count(logical=True), num)
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
@ -38,7 +38,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_against_lscpu(self):
out = sh("lscpu -p")
num = len([x for x in out.split('\n') if not x.startswith('#')])
@@ -731,6 +732,7 @@ class TestSystemCPUCountLogical(PsutilTe
@@ -756,6 +757,7 @@ class TestSystemCPUCountLogical(PsutilTe
class TestSystemCPUCountCores(PsutilTestCase):
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
@ -46,7 +46,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_against_lscpu(self):
out = sh("lscpu -p")
core_ids = set()
@@ -1109,6 +1111,7 @@ class TestSystemDiskPartitions(PsutilTes
@@ -1134,6 +1136,7 @@ class TestSystemDiskPartitions(PsutilTes
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
@skip_on_not_implemented()
@ -54,7 +54,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_against_df(self):
# test psutil.disk_usage() and psutil.disk_partitions()
# against "df -a"
@@ -1283,6 +1286,7 @@ class TestSystemDiskIoCounters(PsutilTes
@@ -1308,6 +1311,7 @@ class TestSystemDiskIoCounters(PsutilTes
self.assertEqual(ret.read_count, 1)
self.assertEqual(ret.write_count, 5)
@ -62,7 +62,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_emulate_use_sysfs(self):
def exists(path):
if path == '/proc/diskstats':
@@ -1326,6 +1330,7 @@ class TestRootFsDeviceFinder(PsutilTestC
@@ -1351,6 +1355,7 @@ class TestRootFsDeviceFinder(PsutilTestC
finder.ask_sys_class_block()
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
@ -70,7 +70,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_comparisons(self):
finder = RootFsDeviceFinder()
self.assertIsNotNone(finder.find())
@@ -1353,6 +1358,7 @@ class TestRootFsDeviceFinder(PsutilTestC
@@ -1378,6 +1383,7 @@ class TestRootFsDeviceFinder(PsutilTestC
findmnt_value = sh("findmnt -o SOURCE -rn /")
self.assertEqual(psutil_value, findmnt_value)
@ -78,7 +78,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_disk_partitions_mocked(self):
with mock.patch(
'psutil._pslinux.cext.disk_partitions',
@@ -1651,6 +1657,8 @@ class TestSensorsBattery(PsutilTestCase)
@@ -1676,6 +1682,8 @@ class TestSensorsBattery(PsutilTestCase)
self.assertIsNone(psutil.sensors_battery().power_plugged)
assert m.called
@ -87,7 +87,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_emulate_energy_full_0(self):
# Emulate a case where energy_full files returns 0.
with mock_open_content(
@@ -1658,6 +1666,8 @@ class TestSensorsBattery(PsutilTestCase)
@@ -1683,6 +1691,8 @@ class TestSensorsBattery(PsutilTestCase)
self.assertEqual(psutil.sensors_battery().percent, 0)
assert m.called
@ -96,7 +96,7 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_emulate_energy_full_not_avail(self):
# Emulate a case where energy_full file does not exist.
# Expected fallback on /capacity.
@@ -2250,6 +2260,7 @@ class TestProcessAgainstStatus(PsutilTes
@@ -2275,6 +2285,7 @@ class TestProcessAgainstStatus(PsutilTes
value = self.read_status_file("nonvoluntary_ctxt_switches:")
self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
@ -104,22 +104,22 @@ Index: psutil-5.9.4/psutil/tests/test_linux.py
def test_cpu_affinity(self):
value = self.read_status_file("Cpus_allowed_list:")
if '-' in str(value):
Index: psutil-5.9.4/psutil/tests/test_posix.py
Index: psutil-5.9.5/psutil/tests/test_posix.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_posix.py
+++ psutil-5.9.4/psutil/tests/test_posix.py
@@ -383,6 +383,7 @@ class TestSystemAPIs(PsutilTestCase):
--- psutil-5.9.5.orig/psutil/tests/test_posix.py
+++ psutil-5.9.5/psutil/tests/test_posix.py
@@ -413,6 +413,7 @@ class TestSystemAPIs(PsutilTestCase):
# 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):
out = sh("df -k %s" % device).strip()
Index: psutil-5.9.4/psutil/tests/test_system.py
try:
Index: psutil-5.9.5/psutil/tests/test_system.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_system.py
+++ psutil-5.9.4/psutil/tests/test_system.py
--- psutil-5.9.5.orig/psutil/tests/test_system.py
+++ psutil-5.9.5/psutil/tests/test_system.py
@@ -201,6 +201,7 @@ class TestMiscAPIs(PsutilTestCase):
self.assertLess(bt, time.time())
@ -136,10 +136,10 @@ Index: psutil-5.9.4/psutil/tests/test_system.py
def test_disk_partitions(self):
def check_ntuple(nt):
self.assertIsInstance(nt.device, str)
Index: psutil-5.9.4/psutil/tests/test_contracts.py
Index: psutil-5.9.5/psutil/tests/test_contracts.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_contracts.py
+++ psutil-5.9.4/psutil/tests/test_contracts.py
--- psutil-5.9.5.orig/psutil/tests/test_contracts.py
+++ psutil-5.9.5/psutil/tests/test_contracts.py
@@ -251,6 +251,7 @@ class TestSystemAPITypes(PsutilTestCase)
self.assertIsInstance(k, str)
self.assert_ntuple_of_nums(v, type_=(int, long))
@ -148,11 +148,11 @@ Index: psutil-5.9.4/psutil/tests/test_contracts.py
def test_disk_partitions(self):
# Duplicate of test_system.py. Keep it anyway.
for disk in psutil.disk_partitions():
Index: psutil-5.9.4/psutil/tests/test_process.py
Index: psutil-5.9.5/psutil/tests/test_process.py
===================================================================
--- psutil-5.9.4.orig/psutil/tests/test_process.py
+++ psutil-5.9.4/psutil/tests/test_process.py
@@ -344,6 +344,7 @@ class TestProcess(PsutilTestCase):
--- psutil-5.9.5.orig/psutil/tests/test_process.py
+++ psutil-5.9.5/psutil/tests/test_process.py
@@ -346,6 +346,7 @@ class TestProcess(PsutilTestCase):
@unittest.skipIf(not HAS_IONICE, "not supported")
@unittest.skipIf(not LINUX, "linux only")