Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-psutil for openSUSE:Factory 
checked in at 2022-11-10 14:19:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-psutil (Old)
 and      /work/SRC/openSUSE:Factory/.python-psutil.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-psutil"

Thu Nov 10 14:19:15 2022 rev:70 rq:1034803 version:5.9.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-psutil/python-psutil.changes      
2022-10-25 11:18:32.217941098 +0200
+++ /work/SRC/openSUSE:Factory/.python-psutil.new.1597/python-psutil.changes    
2022-11-10 14:19:18.569346692 +0100
@@ -1,0 +2,16 @@
+Mon Nov  7 20:52:52 UTC 2022 - Michael Str??der <mich...@stroeder.com>
+
+- update to version 5.9.4:
+  * Enhancements
+    - 2102: use Limited API when building wheels with CPython 3.6+ on Linux,
+      macOS and Windows. This allows to use pre-built wheels in all future
+      versions of cPython 3. (patch by Matthieu Darbois)
+  * Bug fixes
+    - 2077, [Windows]: Use system-level values for virtual_memory().
+      (patch by Daniel Widdis)
+    - 2156, [Linux]: compilation may fail on very old gcc compilers due to
+      missing SPEED_UNKNOWN definition. (patch by Amir Rossert)
+    - 2010, [macOS]: on MacOS, arm64 IFM_1000_TX and IFM_1000_T are
+      the same value, causing a build failure. (patch by Lawrence D'Anna)
+
+-------------------------------------------------------------------

Old:
----
  psutil-5.9.3.tar.gz

New:
----
  psutil-5.9.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-psutil.spec ++++++
--- /var/tmp/diff_new_pack.gxQUtD/_old  2022-11-10 14:19:19.077349492 +0100
+++ /var/tmp/diff_new_pack.gxQUtD/_new  2022-11-10 14:19:19.081349514 +0100
@@ -24,7 +24,7 @@
 %endif
 %bcond_without python2
 Name:           python-psutil
-Version:        5.9.3
+Version:        5.9.4
 Release:        0
 Summary:        A process utilities module for Python
 License:        BSD-3-Clause

++++++ psutil-5.9.3.tar.gz -> psutil-5.9.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/CREDITS new/psutil-5.9.4/CREDITS
--- old/psutil-5.9.3/CREDITS    2022-10-18 22:06:51.000000000 +0200
+++ new/psutil-5.9.4/CREDITS    2022-10-21 22:20:35.000000000 +0200
@@ -781,7 +781,7 @@
 
 N: Matthieu Darbois
 W: https://github.com/mayeut
-I: 2039, 2142, 2147, 2153, 2040
+I: 2039, 2142, 2147, 2153, 2040, 2102
 
 N: Hugo van Kemenade
 W: https://github.com/hugovk
@@ -801,3 +801,15 @@
 
 N: Daniel Li
 I: 2150
+
+N: Daniel Widdis
+W: https://github.com/dbwiddis
+I: 2077
+
+N: Amir Rossert
+W: https://github.com/arossert
+I: 2156
+
+N: Lawrence D'Anna
+W: https://github.com/smoofra
+I: 2010
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/HISTORY.rst new/psutil-5.9.4/HISTORY.rst
--- old/psutil-5.9.3/HISTORY.rst        2022-10-18 22:09:30.000000000 +0200
+++ new/psutil-5.9.4/HISTORY.rst        2022-11-07 19:44:05.000000000 +0100
@@ -1,5 +1,25 @@
 *Bug tracker at https://github.com/giampaolo/psutil/issues*
 
+5.9.4
+=====
+
+2022-11-07
+
+**Enhancements**
+
+- 2102_: use Limited API when building wheels with CPython 3.6+ on Linux,
+  macOS and Windows. This allows to use pre-built wheels in all future versions
+  of cPython 3.  (patch by Matthieu Darbois)
+
+**Bug fixes**
+
+- 2077_, [Windows]: Use system-level values for `virtual_memory()`_. (patch by
+  Daniel Widdis)
+- 2156_, [Linux]: compilation may fail on very old gcc compilers due to missing
+  ``SPEED_UNKNOWN`` definition.  (patch by Amir Rossert)
+- 2010_, [macOS]: on MacOS, arm64 ``IFM_1000_TX`` and ``IFM_1000_T`` are the
+  same value, causing a build failure.  (patch by Lawrence D'Anna)
+
 5.9.3
 =====
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/Makefile new/psutil-5.9.4/Makefile
--- old/psutil-5.9.3/Makefile   2022-10-18 21:12:46.000000000 +0200
+++ new/psutil-5.9.4/Makefile   2022-11-07 20:07:57.000000000 +0100
@@ -270,8 +270,8 @@
        ${MAKE} clean
        $(PYTHON) -m virtualenv --clear --no-wheel --quiet build/venv
        PYTHONWARNINGS=all $(PYTHON) setup.py sdist
-       build/venv/local/bin/python -m pip install -v --isolated --quiet 
dist/*.tar.gz
-       build/venv/local/bin/python -c "import os; os.chdir('build/venv'); 
import psutil"
+       build/venv/bin/python -m pip install -v --isolated --quiet dist/*.tar.gz
+       build/venv/bin/python -c "import os; os.chdir('build/venv'); import 
psutil"
 
 pre-release:  ## Check if we're ready to produce a new release.
        ${MAKE} check-sdist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/PKG-INFO new/psutil-5.9.4/PKG-INFO
--- old/psutil-5.9.3/PKG-INFO   2022-10-18 22:12:14.838520300 +0200
+++ new/psutil-5.9.4/PKG-INFO   2022-11-07 20:27:57.847500300 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: psutil
-Version: 5.9.3
+Version: 5.9.4
 Summary: Cross-platform lib for process and system monitoring in Python.
 Home-page: https://github.com/giampaolo/psutil
 Author: Giampaolo Rodola
@@ -243,7 +243,7 @@
 
     >>> psutil.disk_partitions()
     [sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', 
opts='rw,nosuid', maxfile=255, maxpath=4096),
-     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw', 
maxfile=255, maxpath=4096)]
+     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', 
opts='rw', maxfile=255, maxpath=4096)]
     >>>
     >>> psutil.disk_usage('/')
     sdiskusage(total=21378641920, used=4809781248, free=15482871808, 
percent=22.5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/README.rst new/psutil-5.9.4/README.rst
--- old/psutil-5.9.3/README.rst 2022-10-18 22:08:45.000000000 +0200
+++ new/psutil-5.9.4/README.rst 2022-10-21 22:20:35.000000000 +0200
@@ -221,7 +221,7 @@
 
     >>> psutil.disk_partitions()
     [sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', 
opts='rw,nosuid', maxfile=255, maxpath=4096),
-     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw', 
maxfile=255, maxpath=4096)]
+     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', 
opts='rw', maxfile=255, maxpath=4096)]
     >>>
     >>> psutil.disk_usage('/')
     sdiskusage(total=21378641920, used=4809781248, free=15482871808, 
percent=22.5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/__init__.py 
new/psutil-5.9.4/psutil/__init__.py
--- old/psutil-5.9.3/psutil/__init__.py 2022-10-18 21:05:55.000000000 +0200
+++ new/psutil-5.9.4/psutil/__init__.py 2022-10-21 22:20:35.000000000 +0200
@@ -211,7 +211,7 @@
 AF_LINK = _psplatform.AF_LINK
 
 __author__ = "Giampaolo Rodola'"
-__version__ = "5.9.3"
+__version__ = "5.9.4"
 version_info = tuple([int(num) for num in __version__.split('.')])
 
 _timer = getattr(time, 'monotonic', time.time)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/_psutil_linux.c 
new/psutil-5.9.4/psutil/_psutil_linux.c
--- old/psutil-5.9.3/psutil/_psutil_linux.c     2022-09-19 17:39:41.000000000 
+0200
+++ new/psutil-5.9.4/psutil/_psutil_linux.c     2022-10-21 22:20:35.000000000 
+0200
@@ -58,6 +58,11 @@
 #endif
 
 
+#ifndef SPEED_UNKNOWN
+    #define SPEED_UNKNOWN -1
+#endif
+
+
 #if PSUTIL_HAVE_IOPRIO
 enum {
     IOPRIO_WHO_PROCESS = 1,
@@ -296,52 +301,46 @@
     cpu_set_t cpu_set;
     size_t len;
     pid_t pid;
-    int i, seq_len;
+    Py_ssize_t i, seq_len;
     PyObject *py_cpu_set;
-    PyObject *py_cpu_seq = NULL;
 
     if (!PyArg_ParseTuple(args, _Py_PARSE_PID "O", &pid, &py_cpu_set))
         return NULL;
 
     if (!PySequence_Check(py_cpu_set)) {
-        PyErr_Format(PyExc_TypeError, "sequence argument expected, got %s",
-                     Py_TYPE(py_cpu_set)->tp_name);
-        goto error;
+        return PyErr_Format(PyExc_TypeError, "sequence argument expected, got 
%R", Py_TYPE(py_cpu_set));
     }
 
-    py_cpu_seq = PySequence_Fast(py_cpu_set, "expected a sequence or integer");
-    if (!py_cpu_seq)
-        goto error;
-    seq_len = PySequence_Fast_GET_SIZE(py_cpu_seq);
+    seq_len = PySequence_Size(py_cpu_set);
+    if (seq_len < 0) {
+        return NULL;
+    }
     CPU_ZERO(&cpu_set);
     for (i = 0; i < seq_len; i++) {
-        PyObject *item = PySequence_Fast_GET_ITEM(py_cpu_seq, i);
+        PyObject *item = PySequence_GetItem(py_cpu_set, i);
+        if (!item) {
+            return NULL;
+        }
 #if PY_MAJOR_VERSION >= 3
         long value = PyLong_AsLong(item);
 #else
         long value = PyInt_AsLong(item);
 #endif
+        Py_XDECREF(item);
         if ((value == -1) || PyErr_Occurred()) {
             if (!PyErr_Occurred())
                 PyErr_SetString(PyExc_ValueError, "invalid CPU value");
-            goto error;
+            return NULL;
         }
         CPU_SET(value, &cpu_set);
     }
 
     len = sizeof(cpu_set);
     if (sched_setaffinity(pid, len, &cpu_set)) {
-        PyErr_SetFromErrno(PyExc_OSError);
-        goto error;
+        return PyErr_SetFromErrno(PyExc_OSError);
     }
 
-    Py_DECREF(py_cpu_seq);
     Py_RETURN_NONE;
-
-error:
-    if (py_cpu_seq != NULL)
-        Py_DECREF(py_cpu_seq);
-    return NULL;
 }
 #endif  /* PSUTIL_HAVE_CPU_AFFINITY */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/_psutil_posix.c 
new/psutil-5.9.4/psutil/_psutil_posix.c
--- old/psutil-5.9.3/psutil/_psutil_posix.c     2022-09-19 11:51:52.000000000 
+0200
+++ new/psutil-5.9.4/psutil/_psutil_posix.c     2022-10-21 22:20:35.000000000 
+0200
@@ -708,13 +708,14 @@
                 case(IFM_1000_LX):  // 1000baseLX - single-mode fiber
                 case(IFM_1000_CX):  // 1000baseCX - 150ohm STP
 #if defined(IFM_1000_TX) && !defined(PSUTIL_OPENBSD)
+                #define HAS_CASE_IFM_1000_TX 1
                 // FreeBSD 4 and others (but NOT OpenBSD) -> #define 
IFM_1000_T in net/if_media.h
                 case(IFM_1000_TX):
 #endif
 #ifdef IFM_1000_FX
                 case(IFM_1000_FX):
 #endif
-#ifdef IFM_1000_T
+#if defined(IFM_1000_T) && (!HAS_CASE_IFM_1000_TX || IFM_1000_T != IFM_1000_TX)
                 case(IFM_1000_T):
 #endif
                     return 1000;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/_psutil_windows.c 
new/psutil-5.9.4/psutil/_psutil_windows.c
--- old/psutil-5.9.3/psutil/_psutil_windows.c   2022-09-12 22:07:38.000000000 
+0200
+++ new/psutil-5.9.4/psutil/_psutil_windows.c   2022-11-07 19:39:40.000000000 
+0100
@@ -610,20 +610,25 @@
  */
 static PyObject *
 psutil_virtual_mem(PyObject *self, PyObject *args) {
-    MEMORYSTATUSEX memInfo;
-    memInfo.dwLength = sizeof(MEMORYSTATUSEX);
+    unsigned long long totalPhys, availPhys, totalSys, availSys, pageSize;
+    PERFORMANCE_INFORMATION perfInfo;
 
-    if (! GlobalMemoryStatusEx(&memInfo)) {
+    if (! GetPerformanceInfo(&perfInfo, sizeof(PERFORMANCE_INFORMATION))) {
         PyErr_SetFromWindowsErr(0);
         return NULL;
     }
-    return Py_BuildValue("(LLLLLL)",
-                         memInfo.ullTotalPhys,      // total
-                         memInfo.ullAvailPhys,      // avail
-                         memInfo.ullTotalPageFile,  // total page file
-                         memInfo.ullAvailPageFile,  // avail page file
-                         memInfo.ullTotalVirtual,   // total virtual
-                         memInfo.ullAvailVirtual);  // avail virtual
+    // values are size_t, widen (if needed) to long long
+    pageSize = perfInfo.PageSize;
+    totalPhys = perfInfo.PhysicalTotal * pageSize;
+    availPhys = perfInfo.PhysicalAvailable * pageSize;
+    totalSys = perfInfo.CommitLimit * pageSize;
+    availSys = totalSys - perfInfo.CommitTotal * pageSize;
+    return Py_BuildValue(
+        "(LLLL)",
+        totalPhys,
+        availPhys,
+        totalSys,
+        availSys);
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/_pswindows.py 
new/psutil-5.9.4/psutil/_pswindows.py
--- old/psutil-5.9.3/psutil/_pswindows.py       2022-10-18 21:05:55.000000000 
+0200
+++ new/psutil-5.9.4/psutil/_pswindows.py       2022-11-07 19:39:40.000000000 
+0100
@@ -229,7 +229,7 @@
 def virtual_memory():
     """System virtual memory as a namedtuple."""
     mem = cext.virtual_mem()
-    totphys, availphys, totpagef, availpagef, totvirt, freevirt = mem
+    totphys, availphys, totsys, availsys = mem
     #
     total = totphys
     avail = availphys
@@ -248,8 +248,8 @@
     total_system = mem[2]
     free_system = mem[3]
 
-    # Despite the name PageFile refers to total system memory here
-    # thus physical memory values need to be subtracted to get swap values
+    # system memory (commit total/limit) is the sum of physical and swap
+    # thus physical memory values need to be substracted to get swap values
     total = total_system - total_phys
     free = min(total, free_system - free_phys)
     used = total - free
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/arch/windows/process_info.c 
new/psutil-5.9.4/psutil/arch/windows/process_info.c
--- old/psutil-5.9.3/psutil/arch/windows/process_info.c 2022-09-12 
22:07:38.000000000 +0200
+++ new/psutil-5.9.4/psutil/arch/windows/process_info.c 2022-10-21 
22:20:35.000000000 +0200
@@ -578,7 +578,7 @@
             wcslen(szArglist[i]));
         if (py_unicode == NULL)
             goto out;
-        PyList_SET_ITEM(py_retlist, i, py_unicode);
+        PyList_SetItem(py_retlist, i, py_unicode);
         py_unicode = NULL;
     }
     ret = py_retlist;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/__init__.py 
new/psutil-5.9.4/psutil/tests/__init__.py
--- old/psutil-5.9.3/psutil/tests/__init__.py   2022-10-18 21:05:55.000000000 
+0200
+++ new/psutil-5.9.4/psutil/tests/__init__.py   2022-10-21 22:20:35.000000000 
+0200
@@ -174,7 +174,7 @@
 if CI_TESTING:
     NO_RETRIES *= 3
     GLOBAL_TIMEOUT *= 3
-    TOLERANCE_SYS_MEM *= 3
+    TOLERANCE_SYS_MEM *= 4
     TOLERANCE_DISK_USAGE *= 3
 
 # --- file names
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/test_contracts.py 
new/psutil-5.9.4/psutil/tests/test_contracts.py
--- old/psutil-5.9.3/psutil/tests/test_contracts.py     2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/psutil/tests/test_contracts.py     2022-10-21 
22:20:35.000000000 +0200
@@ -12,6 +12,7 @@
 import errno
 import multiprocessing
 import os
+import platform
 import signal
 import stat
 import sys
@@ -235,6 +236,9 @@
     def test_cpu_count(self):
         self.assertIsInstance(psutil.cpu_count(), int)
 
+    # TODO: remove this once 1892 is fixed
+    @unittest.skipIf(MACOS and platform.machine() == 'arm64',
+                     "skipped due to #1892")
     @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
     def test_cpu_freq(self):
         if psutil.cpu_freq() is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/test_memleaks.py 
new/psutil-5.9.4/psutil/tests/test_memleaks.py
--- old/psutil-5.9.3/psutil/tests/test_memleaks.py      2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/psutil/tests/test_memleaks.py      2022-10-21 
22:20:35.000000000 +0200
@@ -19,6 +19,7 @@
 
 import functools
 import os
+import platform
 import unittest
 
 import psutil
@@ -364,6 +365,9 @@
         self.execute(psutil.cpu_stats)
 
     @fewtimes_if_linux()
+    # TODO: remove this once 1892 is fixed
+    @unittest.skipIf(MACOS and platform.machine() == 'arm64',
+                     "skipped due to #1892")
     @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
     def test_cpu_freq(self):
         self.execute(psutil.cpu_freq)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/test_osx.py 
new/psutil-5.9.4/psutil/tests/test_osx.py
--- old/psutil-5.9.3/psutil/tests/test_osx.py   2022-10-18 21:05:55.000000000 
+0200
+++ new/psutil-5.9.4/psutil/tests/test_osx.py   2022-10-21 22:20:35.000000000 
+0200
@@ -6,6 +6,7 @@
 
 """macOS specific tests."""
 
+import platform
 import re
 import time
 import unittest
@@ -144,6 +145,8 @@
         num = sysctl("sysctl hw.physicalcpu")
         self.assertEqual(num, psutil.cpu_count(logical=False))
 
+    # TODO: remove this once 1892 is fixed
+    @unittest.skipIf(platform.machine() == 'arm64', "skipped due to #1892")
     def test_cpu_freq(self):
         freq = psutil.cpu_freq()
         self.assertEqual(
@@ -189,13 +192,13 @@
     def test_swapmem_sin(self):
         vmstat_val = vm_stat("Pageins")
         psutil_val = psutil.swap_memory().sin
-        self.assertEqual(psutil_val, vmstat_val)
+        self.assertAlmostEqual(psutil_val, vmstat_val, delta=TOLERANCE_SYS_MEM)
 
     @retry_on_failure()
     def test_swapmem_sout(self):
         vmstat_val = vm_stat("Pageout")
         psutil_val = psutil.swap_memory().sout
-        self.assertEqual(psutil_val, vmstat_val)
+        self.assertAlmostEqual(psutil_val, vmstat_val, delta=TOLERANCE_SYS_MEM)
 
     # Not very reliable.
     # def test_swapmem_total(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/test_system.py 
new/psutil-5.9.4/psutil/tests/test_system.py
--- old/psutil-5.9.3/psutil/tests/test_system.py        2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/psutil/tests/test_system.py        2022-10-21 
22:20:35.000000000 +0200
@@ -10,6 +10,7 @@
 import datetime
 import errno
 import os
+import platform
 import pprint
 import shutil
 import signal
@@ -511,6 +512,9 @@
             if not AIX and name in ('ctx_switches', 'interrupts'):
                 self.assertGreater(value, 0)
 
+    # TODO: remove this once 1892 is fixed
+    @unittest.skipIf(MACOS and platform.machine() == 'arm64',
+                     "skipped due to #1892")
     @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
     def test_cpu_freq(self):
         def check_ls(ls):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil/tests/test_windows.py 
new/psutil-5.9.4/psutil/tests/test_windows.py
--- old/psutil-5.9.3/psutil/tests/test_windows.py       2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/psutil/tests/test_windows.py       2022-11-07 
19:39:47.000000000 +0100
@@ -23,6 +23,7 @@
 import psutil
 from psutil import WINDOWS
 from psutil._compat import FileNotFoundError
+from psutil._compat import which
 from psutil._compat import super
 from psutil.tests import APPVEYOR
 from psutil.tests import GITHUB_ACTIONS
@@ -31,6 +32,7 @@
 from psutil.tests import PY3
 from psutil.tests import PYPY
 from psutil.tests import TOLERANCE_DISK_USAGE
+from psutil.tests import TOLERANCE_SYS_MEM
 from psutil.tests import PsutilTestCase
 from psutil.tests import mock
 from psutil.tests import retry_on_failure
@@ -62,6 +64,37 @@
     pass
 
 
+def powershell(cmd):
+    """Currently not used, but avalable just in case. Usage:
+
+    >>> powershell(
+        "Get-CIMInstance Win32_PageFileUsage | Select AllocatedBaseSize")
+    """
+    if not which("powershell.exe"):
+        raise unittest.SkipTest("powershell.exe not available")
+    cmdline = \
+        'powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive ' + \
+        '-NoProfile -WindowStyle Hidden -Command "%s"' % cmd
+    return sh(cmdline)
+
+
+def wmic(path, what, converter=int):
+    """Currently not used, but avalable just in case. Usage:
+
+    >>> wmic("Win32_OperatingSystem", "FreePhysicalMemory")
+    2134124534
+    """
+    out = sh("wmic path %s get %s" % (path, what)).strip()
+    data = "".join(out.splitlines()[1:]).strip()  # get rid of the header
+    if converter is not None:
+        if "," in what:
+            return tuple([converter(x) for x in data.split()])
+        else:
+            return converter(data)
+    else:
+        return data
+
+
 # ===================================================================
 # System APIs
 # ===================================================================
@@ -123,6 +156,12 @@
         self.assertEqual(int(w.TotalPhysicalMemory),
                          psutil.virtual_memory().total)
 
+    def test_free_phymem(self):
+        w = wmi.WMI().Win32_PerfRawData_PerfOS_Memory()[0]
+        self.assertAlmostEqual(
+            int(w.AvailableBytes), psutil.virtual_memory().free,
+            delta=TOLERANCE_SYS_MEM)
+
     # @unittest.skipIf(wmi is None, "wmi module is not installed")
     # def test__UPTIME(self):
     #     # _UPTIME constant is not public but it is used internally
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/psutil.egg-info/PKG-INFO 
new/psutil-5.9.4/psutil.egg-info/PKG-INFO
--- old/psutil-5.9.3/psutil.egg-info/PKG-INFO   2022-10-18 22:12:14.000000000 
+0200
+++ new/psutil-5.9.4/psutil.egg-info/PKG-INFO   2022-11-07 20:27:57.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: psutil
-Version: 5.9.3
+Version: 5.9.4
 Summary: Cross-platform lib for process and system monitoring in Python.
 Home-page: https://github.com/giampaolo/psutil
 Author: Giampaolo Rodola
@@ -243,7 +243,7 @@
 
     >>> psutil.disk_partitions()
     [sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', 
opts='rw,nosuid', maxfile=255, maxpath=4096),
-     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw', 
maxfile=255, maxpath=4096)]
+     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', 
opts='rw', maxfile=255, maxpath=4096)]
     >>>
     >>> psutil.disk_usage('/')
     sdiskusage(total=21378641920, used=4809781248, free=15482871808, 
percent=22.5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/pyproject.toml 
new/psutil-5.9.4/pyproject.toml
--- old/psutil-5.9.3/pyproject.toml     2022-10-18 21:12:46.000000000 +0200
+++ new/psutil-5.9.4/pyproject.toml     2022-10-21 22:20:35.000000000 +0200
@@ -38,12 +38,11 @@
 ]
 
 [build-system]
-requires = ["setuptools>=43"]
+requires = ["setuptools>=43", "wheel"]
 build-backend = "setuptools.build_meta"
 
 [tool.cibuildwheel]
-build = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*"]
-skip = ["*-musllinux*"]
+skip = ["pp*", "*-musllinux*"]
 test-extras = "test"
 test-command = [
     "PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python 
{project}/psutil/tests/runner.py",
@@ -52,3 +51,18 @@
 
 [tool.cibuildwheel.macos]
 archs = ["x86_64", "arm64"]
+
+[tool.cibuildwheel.windows]
+# psutil tests do not like running from a virtualenv with python>=3.7
+# restrict build & tests to cp36
+# cp36-abi3 wheels will need to be tested outside cibuildwheel for python>=3.7
+build = "cp36-*"
+test-command = [
+    "python {project}/psutil/tests/runner.py",
+    "python {project}/psutil/tests/test_memleaks.py"
+]
+
+[tool.cibuildwheel.windows.environment]
+PYTHONWARNINGS = "always"
+PYTHONUNBUFFERED = "1"
+PSUTIL_DEBUG = "1"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/psutil-5.9.3/scripts/internal/download_wheels_appveyor.py 
new/psutil-5.9.4/scripts/internal/download_wheels_appveyor.py
--- old/psutil-5.9.3/scripts/internal/download_wheels_appveyor.py       
2022-10-18 21:05:55.000000000 +0200
+++ new/psutil-5.9.4/scripts/internal/download_wheels_appveyor.py       
2022-11-07 20:27:45.000000000 +0100
@@ -28,7 +28,7 @@
 USER = "giampaolo"
 PROJECT = "psutil"
 BASE_URL = 'https://ci.appveyor.com/api'
-PY_VERSIONS = ['2.7', '3.7', '3.8', '3.9', '3.10']
+PY_VERSIONS = ['2.7']
 TIMEOUT = 30
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/scripts/internal/print_api_speed.py 
new/psutil-5.9.4/scripts/internal/print_api_speed.py
--- old/psutil-5.9.3/scripts/internal/print_api_speed.py        2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/scripts/internal/print_api_speed.py        2022-10-21 
22:20:35.000000000 +0200
@@ -4,48 +4,101 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-"""Benchmark all API calls.
+"""
+Benchmark all API calls and print them from fastest to slowest.
 
 $ make print_api_speed
-SYSTEM APIS               SECONDS
-----------------------------------
-cpu_count                 0.000014
-disk_usage                0.000027
-cpu_times                 0.000037
-cpu_percent               0.000045
-...
-
-PROCESS APIS              SECONDS
-----------------------------------
-create_time               0.000001
-nice                      0.000005
-cwd                       0.000011
-cpu_affinity              0.000011
-ionice                    0.000013
-...
+SYSTEM APIS                NUM CALLS      SECONDS
+-------------------------------------------------
+disk_usage                       300      0.00157
+cpu_count                        300      0.00255
+pid_exists                       300      0.00792
+cpu_times                        300      0.01044
+boot_time                        300      0.01136
+cpu_percent                      300      0.01290
+cpu_times_percent                300      0.01515
+virtual_memory                   300      0.01594
+users                            300      0.01964
+net_io_counters                  300      0.02027
+cpu_stats                        300      0.02034
+net_if_addrs                     300      0.02962
+swap_memory                      300      0.03209
+sensors_battery                  300      0.05186
+pids                             300      0.07954
+net_if_stats                     300      0.09321
+disk_io_counters                 300      0.09406
+cpu_count (cores)                300      0.10293
+disk_partitions                  300      0.10345
+cpu_freq                         300      0.20817
+sensors_fans                     300      0.63476
+sensors_temperatures             231      2.00039
+process_iter (all)               171      2.01300
+net_connections                   97      2.00206
+
+PROCESS APIS               NUM CALLS      SECONDS
+-------------------------------------------------
+create_time                      300      0.00009
+exe                              300      0.00015
+nice                             300      0.00057
+ionice                           300      0.00091
+cpu_affinity                     300      0.00091
+cwd                              300      0.00151
+num_fds                          300      0.00391
+memory_info                      300      0.00597
+memory_percent                   300      0.00648
+io_counters                      300      0.00707
+name                             300      0.00894
+status                           300      0.00900
+ppid                             300      0.00906
+num_threads                      300      0.00932
+cpu_num                          300      0.00933
+num_ctx_switches                 300      0.00943
+uids                             300      0.00979
+gids                             300      0.01002
+cpu_times                        300      0.01008
+cmdline                          300      0.01009
+terminal                         300      0.01059
+is_running                       300      0.01063
+threads                          300      0.01209
+connections                      300      0.01276
+cpu_percent                      300      0.01463
+open_files                       300      0.01630
+username                         300      0.01655
+environ                          300      0.02250
+memory_full_info                 300      0.07066
+memory_maps                      300      0.74281
 """
 
 from __future__ import division
 from __future__ import print_function
 
+import argparse
 import inspect
 import os
+import sys
 from timeit import default_timer as timer
 
 import psutil
 from psutil._common import print_color
 
 
+TIMES = 300
 timings = []
-templ = "%-25s %s"
+templ = "%-25s %10s   %10s"
+
+
+def print_header(what):
+    s = templ % (what, "NUM CALLS", "SECONDS")
+    print_color(s, color=None, bold=True)
+    print("-" * len(s))
 
 
 def print_timings():
-    timings.sort(key=lambda x: x[1])
+    timings.sort(key=lambda x: (x[1], -x[2]), reverse=True)
     i = 0
     while timings[:]:
-        title, elapsed = timings.pop(0)
-        s = templ % (title, "%f" % elapsed)
+        title, times, elapsed = timings.pop(0)
+        s = templ % (title, str(times), "%.5f" % elapsed)
         if i > len(timings) - 5:
             print_color(s, color="red")
         else:
@@ -53,13 +106,50 @@
 
 
 def timecall(title, fun, *args, **kw):
+    print("%-50s" % title, end="")
+    sys.stdout.flush()
     t = timer()
-    fun(*args, **kw)
-    elapsed = timer() - t
-    timings.append((title, elapsed))
+    for n in range(TIMES):
+        fun(*args, **kw)
+        elapsed = timer() - t
+        if elapsed > 2:
+            break
+    print("\r", end="")
+    sys.stdout.flush()
+    timings.append((title, n + 1, elapsed))
+
+
+def set_highest_priority():
+    """Set highest CPU and I/O priority (requires root)."""
+    p = psutil.Process()
+    if psutil.WINDOWS:
+        p.nice(psutil.HIGH_PRIORITY_CLASS)
+    else:
+        p.nice(-20)
+
+    if psutil.LINUX:
+        p.ionice(psutil.IOPRIO_CLASS_RT, value=7)
+    elif psutil.WINDOWS:
+        p.ionice(psutil.IOPRIO_HIGH)
 
 
 def main():
+    global TIMES
+
+    parser = argparse.ArgumentParser(
+        description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
+    parser.add_argument('-t', '--times', type=int, default=TIMES)
+    args = parser.parse_args()
+    TIMES = args.times
+    assert TIMES > 1, TIMES
+
+    try:
+        set_highest_priority()
+    except psutil.AccessDenied:
+        prio_set = False
+    else:
+        prio_set = True
+
     # --- system
 
     public_apis = []
@@ -73,8 +163,7 @@
             if name not in ignore:
                 public_apis.append(name)
 
-    print_color(templ % ("SYSTEM APIS", "SECONDS"), color=None, bold=True)
-    print("-" * 34)
+    print_header("SYSTEM APIS")
     for name in public_apis:
         fun = getattr(psutil, name)
         args = ()
@@ -89,11 +178,10 @@
 
     # --- process
     print("")
-    print_color(templ % ("PROCESS APIS", "SECONDS"), color=None, bold=True)
-    print("-" * 34)
+    print_header("PROCESS APIS")
     ignore = ['send_signal', 'suspend', 'resume', 'terminate', 'kill', 'wait',
               'as_dict', 'parent', 'parents', 'memory_info_ex', 'oneshot',
-              'pid', 'rlimit']
+              'pid', 'rlimit', 'children']
     if psutil.MACOS:
         ignore.append('memory_maps')  # XXX
     p = psutil.Process()
@@ -103,6 +191,10 @@
             timecall(name, fun)
     print_timings()
 
+    if not prio_set:
+        print_color("\nWARN: couldn't set highest process priority " +
+                    "(requires root)", "red")
+
 
 if __name__ == '__main__':
     main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/scripts/internal/winmake.py 
new/psutil-5.9.4/scripts/internal/winmake.py
--- old/psutil-5.9.3/scripts/internal/winmake.py        2022-10-18 
21:05:55.000000000 +0200
+++ new/psutil-5.9.4/scripts/internal/winmake.py        2022-11-07 
19:39:47.000000000 +0100
@@ -383,7 +383,7 @@
     sh("%s -m pip install -U %s" % (PYTHON, " ".join(DEPS)))
 
 
-def check_flake8():
+def flake8():
     """Run flake8 against all py files"""
     py_files = subprocess.check_output("git ls-files")
     if PY3:
@@ -565,7 +565,7 @@
     sp.add_parser('install', help="build + install in develop/edit mode")
     sp.add_parser('install-git-hooks', help="install GIT pre-commit hook")
     sp.add_parser('install-pip', help="install pip")
-    sp.add_parser('check_flake8', help="run flake8 against all py files")
+    sp.add_parser('flake8', help="run flake8 against all py files")
     sp.add_parser('print-access-denied', help="print AD exceptions")
     sp.add_parser('print-api-speed', help="benchmark all API calls")
     sp.add_parser('setup-dev-env', help="install deps")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/psutil-5.9.3/setup.py new/psutil-5.9.4/setup.py
--- old/psutil-5.9.3/setup.py   2022-10-18 21:05:55.000000000 +0200
+++ new/psutil-5.9.4/setup.py   2022-10-21 22:20:35.000000000 +0200
@@ -31,6 +31,12 @@
         setuptools = None
         from distutils.core import Extension
         from distutils.core import setup
+    try:
+        from wheel.bdist_wheel import bdist_wheel
+    except ImportError:
+        if "CIBUILDWHEEL" in os.environ:
+            raise
+        bdist_wheel = None
 
 HERE = os.path.abspath(os.path.dirname(__file__))
 
@@ -53,6 +59,9 @@
 
 
 PYPY = '__pypy__' in sys.builtin_module_names
+PY36_PLUS = sys.version_info[:2] >= (3, 6)
+CP36_PLUS = PY36_PLUS and sys.implementation.name == "cpython"
+
 macros = []
 if POSIX:
     macros.append(("PSUTIL_POSIX", 1))
@@ -100,6 +109,12 @@
 VERSION = get_version()
 macros.append(('PSUTIL_VERSION', int(VERSION.replace('.', ''))))
 
+if bdist_wheel and CP36_PLUS and (MACOS or LINUX or WINDOWS):
+    py_limited_api = {"py_limited_api": True}
+    macros.append(('Py_LIMITED_API', '0x03060000'))
+else:
+    py_limited_api = {}
+
 
 def get_description():
     script = os.path.join(HERE, "scripts", "internal", "convert_readme.py")
@@ -182,7 +197,8 @@
             "ws2_32", "PowrProf", "pdh",
         ],
         # extra_compile_args=["/W 4"],
-        # extra_link_args=["/DEBUG"]
+        # extra_link_args=["/DEBUG"],
+        **py_limited_api
     )
 
 elif MACOS:
@@ -197,7 +213,8 @@
         define_macros=macros,
         extra_link_args=[
             '-framework', 'CoreFoundation', '-framework', 'IOKit'
-        ])
+        ],
+        **py_limited_api)
 
 elif FREEBSD:
     macros.append(("PSUTIL_FREEBSD", 1))
@@ -214,7 +231,8 @@
             'psutil/arch/freebsd/proc_socks.c',
         ],
         define_macros=macros,
-        libraries=["devstat"])
+        libraries=["devstat"],
+        **py_limited_api)
 
 elif OPENBSD:
     macros.append(("PSUTIL_OPENBSD", 1))
@@ -228,7 +246,8 @@
             'psutil/arch/openbsd/proc.c',
         ],
         define_macros=macros,
-        libraries=["kvm"])
+        libraries=["kvm"],
+        **py_limited_api)
 
 elif NETBSD:
     macros.append(("PSUTIL_NETBSD", 1))
@@ -240,7 +259,8 @@
             'psutil/arch/netbsd/socks.c',
         ],
         define_macros=macros,
-        libraries=["kvm"])
+        libraries=["kvm"],
+        **py_limited_api)
 
 elif LINUX:
     def get_ethtool_macro():
@@ -276,7 +296,8 @@
     ext = Extension(
         'psutil._psutil_linux',
         sources=sources + ['psutil/_psutil_linux.c'],
-        define_macros=macros)
+        define_macros=macros,
+        **py_limited_api)
 
 elif SUNOS:
     macros.append(("PSUTIL_SUNOS", 1))
@@ -288,7 +309,8 @@
             'psutil/arch/solaris/environ.c'
         ],
         define_macros=macros,
-        libraries=['kstat', 'nsl', 'socket'])
+        libraries=['kstat', 'nsl', 'socket'],
+        **py_limited_api)
 
 elif AIX:
     macros.append(("PSUTIL_AIX", 1))
@@ -300,7 +322,8 @@
             'psutil/arch/aix/common.c',
             'psutil/arch/aix/ifaddrs.c'],
         libraries=['perfstat'],
-        define_macros=macros)
+        define_macros=macros,
+        **py_limited_api)
 
 else:
     sys.exit('platform %s is not supported' % sys.platform)
@@ -310,7 +333,8 @@
     posix_extension = Extension(
         'psutil._psutil_posix',
         define_macros=macros,
-        sources=sources)
+        sources=sources,
+        **py_limited_api)
     if SUNOS:
         def get_sunos_update():
             # See https://serverfault.com/q/524883
@@ -341,11 +365,21 @@
 else:
     extensions = [ext]
 
+cmdclass = {}
+if py_limited_api:
+    class bdist_wheel_abi3(bdist_wheel):
+        def get_tag(self):
+            python, abi, plat = bdist_wheel.get_tag(self)
+            return python, "abi3", plat
+
+    cmdclass["bdist_wheel"] = bdist_wheel_abi3
+
 
 def main():
     kwargs = dict(
         name='psutil',
         version=VERSION,
+        cmdclass=cmdclass,
         description=__doc__ .replace('\n', ' ').strip() if __doc__ else '',
         long_description=get_description(),
         long_description_content_type='text/x-rst',

Reply via email to