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-09-15 22:57:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-psutil (Old) and /work/SRC/openSUSE:Factory/.python-psutil.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-psutil" Thu Sep 15 22:57:47 2022 rev:68 rq:1003536 version:5.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-psutil/python-psutil.changes 2022-08-04 13:23:14.652461337 +0200 +++ /work/SRC/openSUSE:Factory/.python-psutil.new.2083/python-psutil.changes 2022-09-15 22:57:59.525012397 +0200 @@ -1,0 +2,16 @@ +Sat Sep 10 15:41:34 UTC 2022 - Arun Persaud <a...@gmx.de> + +- update to version 5.9.2: + * Bug fixes + + 2093_, [FreeBSD], **[critical]**: `pids()`_ may fail with + ENOMEM. Dynamically increase the "malloc()" buffer size until + it's big enough. + + 2095_, [Linux]: `net_if_stats()`_ returns incorrect interface + speed for 100GbE network cards. + + 2113_, [FreeBSD], **[critical]**: `virtual_memory()`_ may raise + ENOMEM due to missing "#include <sys/param.h>" directive. + (patch by Peter Jeremy) + + 2128_, [NetBSD]: `swap_memory()`_ was miscalculated. (patch by + Thomas Klausner) + +------------------------------------------------------------------- Old: ---- psutil-5.9.1.tar.gz New: ---- psutil-5.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-psutil.spec ++++++ --- /var/tmp/diff_new_pack.OYgfVA/_old 2022-09-15 22:58:00.997016552 +0200 +++ /var/tmp/diff_new_pack.OYgfVA/_new 2022-09-15 22:58:01.009016586 +0200 @@ -24,7 +24,7 @@ %endif %bcond_without python2 Name: python-psutil -Version: 5.9.1 +Version: 5.9.2 Release: 0 Summary: A process utilities module for Python License: BSD-3-Clause @@ -44,11 +44,11 @@ BuildRequires: python-rpm-macros Requires: procps %if %{with test} -%if 0%{suse_version} < 1550 -BuildRequires: %{python_module unittest2} -%endif BuildRequires: net-tools BuildRequires: procps +%if 0%{?suse_version} < 1550 +BuildRequires: %{python_module unittest2} +%endif %if %{with python2} BuildRequires: python-ipaddress BuildRequires: python-mock ++++++ psutil-5.9.1.tar.gz -> psutil-5.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/.flake8 new/psutil-5.9.2/.flake8 --- old/psutil-5.9.1/.flake8 2021-11-22 19:18:05.000000000 +0100 +++ new/psutil-5.9.2/.flake8 2022-09-02 12:06:38.000000000 +0200 @@ -1,15 +1,28 @@ # Configuration file for flake 8. This is used by "make lint" and by the # GIT commit hook script. -# T001 = print() statement [flake8] ignore = - # line break after binary operator - W504 + W504 # line break after binary operator + + # --- flake8-bugbear plugin + B007 # Loop control variable 'keyword' not used within the loop body. If this is intended, start the name with an underscore. + B014 # Redundant exception types in `except (IOError, OSError) as err:`. Write `except OSError as err:`, which catches exactly the same exceptions. + B008 # Do not perform function calls in argument defaults. + + # --- flake8-blind-except plugin + B902 # blind except Exception: statement + + # --- flake8-quotes plugin + Q000 # Double quotes found but single quotes preferred + + # --- flake8-quotes naming; disable all except N804 and N805 + N801, N802, N803, N806, N807, N811, N812, N813, N814, N815, N816, N817, N818 + per-file-ignores = - setup.py:T001 - scripts/*:T001 - scripts/internal/convert_readme.py:E501,T001 - psutil/tests/runner.py:T001 - psutil/tests/test_memleaks.py:T001 - .github/workflows/*:T001 + # T001, T201 = print() statement (flake8-print plugin) + setup.py:T001,T201 + scripts/*:T001,T201 + psutil/tests/runner.py:T001,T201 + psutil/tests/test_memleaks.py:T001,T201 + .github/workflows/*:T001,T201 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/CREDITS new/psutil-5.9.2/CREDITS --- old/psutil-5.9.1/CREDITS 2022-04-16 14:48:00.000000000 +0200 +++ new/psutil-5.9.2/CREDITS 2022-09-02 12:06:46.000000000 +0200 @@ -85,7 +85,7 @@ N: Thomas Klausner W: https://github.com/0-wiz-0 D: NetBSD implementation (co-author). -I: 557 +I: 557, 2128 N: Ryo Onodera W: https://github.com/ryoon @@ -786,3 +786,6 @@ N: Hugo van Kemenade W: https://github.com/hugovk I: 2099 + +N: Torsten Blum +I: 2114 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/HISTORY.rst new/psutil-5.9.2/HISTORY.rst --- old/psutil-5.9.1/HISTORY.rst 2022-05-20 22:01:20.000000000 +0200 +++ new/psutil-5.9.2/HISTORY.rst 2022-09-04 21:57:30.000000000 +0200 @@ -1,5 +1,20 @@ *Bug tracker at https://github.com/giampaolo/psutil/issues* +5.9.2 +===== + +2022-09-04 + +**Bug fixes** + +- 2093_, [FreeBSD], **[critical]**: `pids()`_ may fail with ENOMEM. Dynamically + increase the ``malloc()`` buffer size until it's big enough. +- 2095_, [Linux]: `net_if_stats()`_ returns incorrect interface speed for + 100GbE network cards. +- 2113_, [FreeBSD], **[critical]**: `virtual_memory()`_ may raise ENOMEM due to + missing ``#include <sys/param.h>`` directive. (patch by Peter Jeremy) +- 2128_, [NetBSD]: `swap_memory()`_ was miscalculated. (patch by Thomas Klausner) + 5.9.1 ===== @@ -7,12 +22,13 @@ **Enhancements** -- 1053_: dropped support for Python 2.6. (patches by Matthieu Darbois and Hugo van Kemenade) +- 1053_: drop Python 2.6 support. (patches by Matthieu Darbois and Hugo van + Kemenade) - 2050_, [Linux]: increase ``read(2)`` buffer size from 1k to 32k when reading ``/proc`` pseudo files line by line. This should help having more consistent results. - 2057_, [OpenBSD]: add support for `cpu_freq()`_. -- 2107_ [Linux]: `Process.memory_full_info()`_ (reporting process USS/PSS/Swap +- 2107_, [Linux]: `Process.memory_full_info()`_ (reporting process USS/PSS/Swap memory) now reads ``/proc/pid/smaps_rollup`` instead of ``/proc/pids/smaps``, which makes it 5 times faster. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/MANIFEST.in new/psutil-5.9.2/MANIFEST.in --- old/psutil-5.9.1/MANIFEST.in 2022-05-20 22:08:06.000000000 +0200 +++ new/psutil-5.9.2/MANIFEST.in 2022-09-04 22:09:45.000000000 +0200 @@ -147,7 +147,6 @@ include scripts/internal/print_timeline.py include scripts/internal/print_wheels.py include scripts/internal/purge_installation.py -include scripts/internal/tidelift.py include scripts/internal/winmake.py include scripts/iotop.py include scripts/killall.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/Makefile new/psutil-5.9.2/Makefile --- old/psutil-5.9.1/Makefile 2022-04-16 14:53:18.000000000 +0200 +++ new/psutil-5.9.2/Makefile 2022-09-04 22:08:49.000000000 +0200 @@ -9,14 +9,19 @@ # Internal. DEPS = \ - autoflake \ + git+https://github.com/PyCQA/autoflake.git \ autopep8 \ check-manifest \ concurrencytest \ coverage \ flake8 \ + flake8-blind-except \ + flake8-bugbear \ + flake8-debugger \ flake8-print \ + flake8-quotes \ isort \ + pep8-naming \ pyperf \ pypinfo \ requests \ @@ -39,10 +44,11 @@ print('--parallel %s' % cpus if cpus > 1 else '')"` # In not in a virtualenv, add --user options for install commands. INSTALL_OPTS = `$(PYTHON) -c \ - "import sys; print('' if hasattr(sys, 'real_prefix') else '--user')"` + "import sys; print('' if hasattr(sys, 'real_prefix') or hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix else '--user')"` TEST_PREFIX = PYTHONWARNINGS=always PSUTIL_DEBUG=1 -all: help +# if make is invoked with no arg, default to `make help` +.DEFAULT_GOAL := help # =================================================================== # Install @@ -70,17 +76,14 @@ docs/_build/ \ htmlcov/ -_: - -build: _ ## Compile (in parallel) without installing. +.PHONY: build +build: ## Compile (in parallel) without installing. @# "build_ext -i" copies compiled *.so files in ./psutil directory in order @# to allow "import psutil" when using the interactive interpreter from @# within this directory. PYTHONWARNINGS=all $(PYTHON) setup.py build_ext -i $(BUILD_OPTS) install: ## Install this package as current user in "edit" mode. - # make sure setuptools is installed (needed for 'develop' / edit mode) - $(PYTHON) -c "import setuptools" ${MAKE} build PYTHONWARNINGS=all $(PYTHON) setup.py develop $(INSTALL_OPTS) $(PYTHON) -c "import psutil" # make sure it actually worked @@ -188,32 +191,32 @@ # Linters # =================================================================== -check-flake8: ## Run flake8 linter. +flake8: ## Run flake8 linter. @git ls-files '*.py' | xargs $(PYTHON) -m flake8 --config=.flake8 -check-imports: ## Run isort linter. +isort: ## Run isort linter. @git ls-files '*.py' | xargs $(PYTHON) -m isort --settings=.isort.cfg --check-only -check-c-code: ## Run C linter. +c-linter: ## Run C linter. @git ls-files '*.c' '*.h' | xargs $(PYTHON) scripts/internal/clinter.py -check-all: ## Run all linters - ${MAKE} check-flake8 - ${MAKE} check-imports - ${MAKE} check-c-code +lint-all: ## Run all linters + ${MAKE} flake8 + ${MAKE} isort + ${MAKE} c-linter # =================================================================== # Fixers # =================================================================== fix-flake8: ## Run autopep8, fix some Python flake8 / pep8 issues. - git ls-files | grep \\.py$ | xargs $(PYTHON) -m autopep8 --in-place --jobs 0 --global-config=.flake8 - git ls-files | grep \\.py$ | xargs $(PYTHON) -m autoflake --in-place --remove-all-unused-imports --remove-unused-variables + @git ls-files '*.py' | xargs $(PYTHON) -m autopep8 --in-place --jobs 0 --global-config=.flake8 + @git ls-files '*.py' | xargs $(PYTHON) -m autoflake --in-place --jobs 0 --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys fix-imports: ## Fix imports with isort. @git ls-files '*.py' | xargs $(PYTHON) -m isort --settings=.isort.cfg -fix-all: +fix-all: ## Run all code fixers. ${MAKE} fix-flake8 ${MAKE} fix-imports @@ -267,11 +270,8 @@ ${MAKE} clean $(PYTHON) -m virtualenv --clear --no-wheel --quiet build/venv PYTHONWARNINGS=all $(PYTHON) setup.py sdist - 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" - -tidelift-relnotes: ## upload release notes from HISTORY - $(PYTHON) scripts/internal/tidelift.py + 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" pre-release: ## Check if we're ready to produce a new release. ${MAKE} check-sdist @@ -296,7 +296,6 @@ $(PYTHON) -c "import subprocess, sys; out = subprocess.check_output('git diff --quiet && git diff --cached --quiet', shell=True).strip(); sys.exit('there are uncommitted changes:\n%s' % out) if out else 0 ;" $(PYTHON) -m twine upload dist/* # upload tar.gz and Windows wheels on PyPI ${MAKE} git-tag-release - ${MAKE} tidelift-relnotes check-manifest: ## Inspect MANIFEST.in file. $(PYTHON) -m check_manifest -v $(ARGS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/PKG-INFO new/psutil-5.9.2/PKG-INFO --- old/psutil-5.9.1/PKG-INFO 2022-05-20 22:08:08.488345900 +0200 +++ new/psutil-5.9.2/PKG-INFO 2022-09-04 22:09:46.154178900 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: psutil -Version: 5.9.1 +Version: 5.9.2 Summary: Cross-platform lib for process and system monitoring in Python. Home-page: https://github.com/giampaolo/psutil Author: Giampaolo Rodola @@ -517,5 +517,3 @@ - Rust: https://github.com/rust-psutil/rust-psutil - Nim: https://github.com/johnscillieri/psutil-nim - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/__init__.py new/psutil-5.9.2/psutil/__init__.py --- old/psutil-5.9.1/psutil/__init__.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/psutil/__init__.py 2022-09-02 18:49:38.000000000 +0200 @@ -211,7 +211,7 @@ AF_LINK = _psplatform.AF_LINK __author__ = "Giampaolo Rodola'" -__version__ = "5.9.1" +__version__ = "5.9.2" version_info = tuple([int(num) for num in __version__.split('.')]) _timer = getattr(time, 'monotonic', time.time) @@ -228,7 +228,7 @@ if (int(__version__.replace('.', '')) != getattr(_psplatform.cext, 'version', None)): msg = "version conflict: %r C extension module was built for another " \ - "version of psutil" % getattr(_psplatform.cext, "__file__") + "version of psutil" % _psplatform.cext.__file__ if hasattr(_psplatform.cext, 'version'): msg += " (%s instead of %s)" % ( '.'.join([x for x in str(_psplatform.cext.version)]), __version__) @@ -325,7 +325,7 @@ - use is_running() before querying the process - if you're continuously iterating over a set of Process instances use process_iter() which pre-emptively checks - process identity for every yielded instance + process identity for every yielded instance """ def __init__(self, pid=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/_compat.py new/psutil-5.9.2/psutil/_compat.py --- old/psutil-5.9.1/psutil/_compat.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/psutil/_compat.py 2022-09-02 12:06:38.000000000 +0200 @@ -232,8 +232,8 @@ return self.hashvalue def _make_key(args, kwds, typed, - kwd_mark=(object(), ), - fasttypes=set((int, str, frozenset, type(None))), + kwd_mark=(_SENTINEL, ), + fasttypes=set((int, str, frozenset, type(None))), # noqa sorted=sorted, tuple=tuple, type=type, len=len): key = args if kwds: @@ -442,9 +442,9 @@ except ImportError: @contextlib.contextmanager def redirect_stderr(new_target): - original = getattr(sys, "stderr") + original = sys.stderr try: - setattr(sys, "stderr", new_target) + sys.stderr = new_target yield new_target finally: - setattr(sys, "stderr", original) + sys.stderr = original diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/_psbsd.py new/psutil-5.9.2/psutil/_psbsd.py --- old/psutil-5.9.1/psutil/_psbsd.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/psutil/_psbsd.py 2022-09-02 12:06:46.000000000 +0200 @@ -189,6 +189,8 @@ buffers = int(line.split()[1]) * 1024 elif line.startswith(b'MemShared:'): shared = int(line.split()[1]) * 1024 + elif line.startswith(b'Cached:'): + cached = int(line.split()[1]) * 1024 avail = inactive + cached + free used = active + wired + cached percent = usage_percent((total - avail), total, round_=1) @@ -326,11 +328,11 @@ if available_freq: try: min_freq = int(available_freq.split(" ")[-1].split("/")[0]) - except(IndexError, ValueError): + except (IndexError, ValueError): min_freq = None try: max_freq = int(available_freq.split(" ")[0].split("/")[0]) - except(IndexError, ValueError): + except (IndexError, ValueError): max_freq = None ret.append(_common.scpufreq(current, min_freq, max_freq)) return ret @@ -453,7 +455,7 @@ return _common.sbattery(percent, secsleft, power_plugged) def sensors_temperatures(): - "Return CPU cores temperatures if available, else an empty dict." + """Return CPU cores temperatures if available, else an empty dict.""" ret = defaultdict(list) num_cpus = cpu_count_logical() for cpu in range(num_cpus): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/_psutil_linux.c new/psutil-5.9.2/psutil/_psutil_linux.c --- old/psutil-5.9.1/psutil/_psutil_linux.c 2022-04-18 09:19:30.000000000 +0200 +++ new/psutil-5.9.2/psutil/_psutil_linux.c 2022-09-02 12:06:38.000000000 +0200 @@ -417,6 +417,7 @@ int sock = 0; int ret; int duplex; + __u32 uint_speed; int speed; struct ifreq ifr; struct ethtool_cmd ethcmd; @@ -438,7 +439,15 @@ if (ret != -1) { duplex = ethcmd.duplex; - speed = ethcmd.speed; + // speed is returned from ethtool as a __u32 ranging from 0 to INT_MAX + // or SPEED_UNKNOWN (-1) + uint_speed = ethtool_cmd_speed(ðcmd); + if (uint_speed == (__u32)SPEED_UNKNOWN || uint_speed > INT_MAX) { + speed = 0; + } + else { + speed = (int)uint_speed; + } } else { if ((errno == EOPNOTSUPP) || (errno == EINVAL)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/arch/freebsd/mem.c new/psutil-5.9.2/psutil/arch/freebsd/mem.c --- old/psutil-5.9.1/psutil/arch/freebsd/mem.c 2022-01-17 13:10:50.000000000 +0100 +++ new/psutil-5.9.2/psutil/arch/freebsd/mem.c 2022-09-02 12:06:38.000000000 +0200 @@ -6,6 +6,7 @@ #include <Python.h> +#include <sys/param.h> #include <sys/sysctl.h> #include <sys/vmmeter.h> #include <vm/vm_param.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/arch/freebsd/proc.c new/psutil-5.9.2/psutil/arch/freebsd/proc.c --- old/psutil-5.9.1/psutil/arch/freebsd/proc.c 2022-01-17 13:10:50.000000000 +0100 +++ new/psutil-5.9.2/psutil/arch/freebsd/proc.c 2022-09-02 14:05:17.000000000 +0200 @@ -83,6 +83,7 @@ struct kinfo_proc *buf = NULL; int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PROC, 0 }; size_t length = 0; + size_t max_length = 12 * 1024 * 1024; // 12MB assert(procList != NULL); assert(*procList == NULL); @@ -95,20 +96,36 @@ return 1; } - // Allocate an appropriately sized buffer based on the results - // from the previous call. - buf = malloc(length); - if (buf == NULL) { - PyErr_NoMemory(); - return 1; - } + while (1) { + // Allocate an appropriately sized buffer based on the results + // from the previous call. + buf = malloc(length); + if (buf == NULL) { + PyErr_NoMemory(); + return 1; + } - // Call sysctl again with the new buffer. - err = sysctl(name, 3, buf, &length, NULL, 0); - if (err == -1) { - PyErr_SetFromOSErrnoWithSyscall("sysctl"); - free(buf); - return 1; + // Call sysctl again with the new buffer. + err = sysctl(name, 3, buf, &length, NULL, 0); + if (err == -1) { + free(buf); + if (errno == ENOMEM) { + // Sometimes the first sysctl() suggested size is not enough, + // so we dynamically increase it until it's big enough : + // https://github.com/giampaolo/psutil/issues/2093 + psutil_debug("errno=ENOMEM, length=%zu; retrying", length); + length *= 2; + if (length < max_length) { + continue; + } + } + + PyErr_SetFromOSErrnoWithSyscall("sysctl()"); + return 1; + } + else { + break; + } } *procList = buf; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/arch/freebsd/proc_socks.c new/psutil-5.9.2/psutil/arch/freebsd/proc_socks.c --- old/psutil-5.9.1/psutil/arch/freebsd/proc_socks.c 2021-11-22 19:18:05.000000000 +0100 +++ new/psutil-5.9.2/psutil/arch/freebsd/proc_socks.c 2022-09-02 12:06:38.000000000 +0200 @@ -8,6 +8,7 @@ */ #include <Python.h> +#include <sys/param.h> #include <sys/user.h> #include <sys/socketvar.h> // for struct xsocket #include <sys/un.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/arch/freebsd/sys_socks.c new/psutil-5.9.2/psutil/arch/freebsd/sys_socks.c --- old/psutil-5.9.1/psutil/arch/freebsd/sys_socks.c 2021-11-22 19:18:05.000000000 +0100 +++ new/psutil-5.9.2/psutil/arch/freebsd/sys_socks.c 2022-09-02 12:06:38.000000000 +0200 @@ -10,6 +10,7 @@ */ #include <Python.h> +#include <sys/param.h> #include <sys/user.h> #include <sys/file.h> #include <sys/socketvar.h> // for struct xsocket diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/arch/netbsd/specific.c new/psutil-5.9.2/psutil/arch/netbsd/specific.c --- old/psutil-5.9.1/psutil/arch/netbsd/specific.c 2022-02-01 22:23:36.000000000 +0100 +++ new/psutil-5.9.2/psutil/arch/netbsd/specific.c 2022-09-02 12:06:46.000000000 +0200 @@ -459,7 +459,7 @@ (unsigned long long) uv.active << uv.pageshift, // active (unsigned long long) uv.inactive << uv.pageshift, // inactive (unsigned long long) uv.wired << uv.pageshift, // wired - (unsigned long long) uv.filepages + uv.execpages * pagesize, // cached + (unsigned long long) (uv.filepages + uv.execpages) * pagesize, // cached // These are determined from /proc/meminfo in Python. (unsigned long long) 0, // buffers (unsigned long long) 0 // shared @@ -495,8 +495,8 @@ swap_total = swap_free = 0; for (i = 0; i < nswap; i++) { if (swdev[i].se_flags & SWF_ENABLE) { - swap_total += swdev[i].se_nblks * DEV_BSIZE; - swap_free += (swdev[i].se_nblks - swdev[i].se_inuse) * DEV_BSIZE; + swap_total += (uint64_t)swdev[i].se_nblks * DEV_BSIZE; + swap_free += (uint64_t)(swdev[i].se_nblks - swdev[i].se_inuse) * DEV_BSIZE; } } free(swdev); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/tests/__init__.py new/psutil-5.9.2/psutil/tests/__init__.py --- old/psutil-5.9.1/psutil/tests/__init__.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/psutil/tests/__init__.py 2022-09-02 12:06:38.000000000 +0200 @@ -21,6 +21,7 @@ import random import re import select +import shlex import shutil import signal import socket @@ -450,14 +451,14 @@ """run cmd in a subprocess and return its output. raises RuntimeError on error. """ - shell = True if isinstance(cmd, (str, unicode)) else False # Prevents subprocess to open error dialogs in case of error. - flags = 0x8000000 if WINDOWS and shell else 0 - kwds.setdefault("shell", shell) + flags = 0x8000000 if WINDOWS else 0 kwds.setdefault("stdout", subprocess.PIPE) kwds.setdefault("stderr", subprocess.PIPE) kwds.setdefault("universal_newlines", True) kwds.setdefault("creationflags", flags) + if isinstance(cmd, str): + cmd = shlex.split(cmd) p = subprocess.Popen(cmd, **kwds) _subprocesses_started.add(p) if PY3: @@ -739,7 +740,7 @@ def safe_rmpath(path): - "Convenience function for removing temporary test files or dirs" + """Convenience function for removing temporary test files or dirs.""" def retry_fun(fun): # On Windows it could happen that the file or directory has # open handles or references preventing the delete operation @@ -772,7 +773,7 @@ def safe_mkdir(dir): - "Convenience function for creating a directory" + """Convenience function for creating a directory.""" try: os.mkdir(dir) except FileExistsError: @@ -781,7 +782,7 @@ @contextlib.contextmanager def chdir(dirname): - "Context manager which temporarily changes the current directory." + """Context manager which temporarily changes the current directory.""" curdir = os.getcwd() try: os.chdir(dirname) @@ -1002,7 +1003,7 @@ def _call_ntimes(self, fun, times): """Get 2 distinct memory samples, before and after having - called fun repeadetly, and return the memory difference. + called fun repeatedly, and return the memory difference. """ gc.collect(generation=1) mem1 = self._get_mem() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/tests/foo.py new/psutil-5.9.2/psutil/tests/foo.py --- old/psutil-5.9.1/psutil/tests/foo.py 2022-04-09 02:40:06.000000000 +0200 +++ new/psutil-5.9.2/psutil/tests/foo.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -import pathlib, os - - -for path in pathlib.Path(os.getcwd()).parents: - if os.path.isdir(os.path.join(path, ".git")): - print(str(path)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/tests/test_contracts.py new/psutil-5.9.2/psutil/tests/test_contracts.py --- old/psutil-5.9.1/psutil/tests/test_contracts.py 2022-05-16 10:33:36.000000000 +0200 +++ new/psutil-5.9.2/psutil/tests/test_contracts.py 2022-09-04 21:55:40.000000000 +0200 @@ -680,7 +680,7 @@ for fname in nt._fields: value = getattr(nt, fname) if fname == 'path': - if not value.startswith('['): + if not value.startswith(("[", "anon_inode:")): assert os.path.isabs(nt.path), nt.path # commented as on Linux we might get # '/foo/bar (deleted)' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/tests/test_linux.py new/psutil-5.9.2/psutil/tests/test_linux.py --- old/psutil-5.9.1/psutil/tests/test_linux.py 2022-05-20 22:00:45.000000000 +0200 +++ new/psutil-5.9.2/psutil/tests/test_linux.py 2022-09-02 12:06:38.000000000 +0200 @@ -976,6 +976,7 @@ @unittest.skipIf(not LINUX, "LINUX only") class TestSystemNetIfStats(PsutilTestCase): + @unittest.skipIf(not which("ifconfig"), "ifconfig utility not available") def test_against_ifconfig(self): for name, stats in psutil.net_if_stats().items(): try: @@ -996,6 +997,7 @@ @unittest.skipIf(not LINUX, "LINUX only") class TestSystemNetIOCounters(PsutilTestCase): + @unittest.skipIf(not which("ifconfig"), "ifconfig utility not available") @retry_on_failure() def test_against_ifconfig(self): def ifconfig(nic): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil/tests/test_misc.py new/psutil-5.9.2/psutil/tests/test_misc.py --- old/psutil-5.9.1/psutil/tests/test_misc.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/psutil/tests/test_misc.py 2022-09-02 12:06:38.000000000 +0200 @@ -296,7 +296,7 @@ def test_memoize(self): @memoize def foo(*args, **kwargs): - "foo docstring" + """foo docstring""" calls.append(None) return (args, kwargs) @@ -402,7 +402,7 @@ supports_ipv6.cache_clear() assert s.called else: - with self.assertRaises(Exception): + with self.assertRaises(socket.error): sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) try: sock.bind(("::1", 0)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil.egg-info/PKG-INFO new/psutil-5.9.2/psutil.egg-info/PKG-INFO --- old/psutil-5.9.1/psutil.egg-info/PKG-INFO 2022-05-20 22:08:07.000000000 +0200 +++ new/psutil-5.9.2/psutil.egg-info/PKG-INFO 2022-09-04 22:09:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: psutil -Version: 5.9.1 +Version: 5.9.2 Summary: Cross-platform lib for process and system monitoring in Python. Home-page: https://github.com/giampaolo/psutil Author: Giampaolo Rodola @@ -517,5 +517,3 @@ - Rust: https://github.com/rust-psutil/rust-psutil - Nim: https://github.com/johnscillieri/psutil-nim - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/psutil.egg-info/SOURCES.txt new/psutil-5.9.2/psutil.egg-info/SOURCES.txt --- old/psutil-5.9.1/psutil.egg-info/SOURCES.txt 2022-05-20 22:08:08.000000000 +0200 +++ new/psutil-5.9.2/psutil.egg-info/SOURCES.txt 2022-09-04 22:09:46.000000000 +0200 @@ -11,7 +11,6 @@ Makefile README.rst make.bat -pyproject.toml setup.py docs/DEVGUIDE.rst docs/DEVNOTES @@ -115,7 +114,6 @@ psutil/tests/README.rst psutil/tests/__init__.py psutil/tests/__main__.py -psutil/tests/foo.py psutil/tests/runner.py psutil/tests/test_aix.py psutil/tests/test_bsd.py @@ -172,5 +170,4 @@ scripts/internal/print_timeline.py scripts/internal/print_wheels.py scripts/internal/purge_installation.py -scripts/internal/tidelift.py scripts/internal/winmake.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/pyproject.toml new/psutil-5.9.2/pyproject.toml --- old/psutil-5.9.1/pyproject.toml 2022-05-15 12:46:31.000000000 +0200 +++ new/psutil-5.9.2/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -[tool.black] -line-length = 79 -skip-string-normalization = true -skip-magic-trailing-comma = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/scripts/internal/convert_readme.py new/psutil-5.9.2/scripts/internal/convert_readme.py --- old/psutil-5.9.1/scripts/internal/convert_readme.py 2022-03-28 14:43:01.000000000 +0200 +++ new/psutil-5.9.2/scripts/internal/convert_readme.py 2022-09-02 12:06:38.000000000 +0200 @@ -36,7 +36,7 @@ `Add your logo <https://github.com/sponsors/giampaolo>`__. -Example usages""" +Example usages""" # noqa def main(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/scripts/internal/git_pre_commit.py new/psutil-5.9.2/scripts/internal/git_pre_commit.py --- old/psutil-5.9.1/scripts/internal/git_pre_commit.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/scripts/internal/git_pre_commit.py 2022-09-02 12:06:38.000000000 +0200 @@ -109,14 +109,14 @@ print("%s:%s %r" % (path, lineno, line)) return exit("space at end of line") line = line.rstrip() - # pdb - if "pdb.set_trace" in line: - print("%s:%s %s" % (path, lineno, line)) - return exit("you forgot a pdb in your python code") - # bare except clause - if "except:" in line and not line.endswith("# NOQA"): - print("%s:%s %s" % (path, lineno, line)) - return exit("bare except clause") + # # pdb (now provided by flake8-debugger plugin) + # if "pdb.set_trace" in line: + # print("%s:%s %s" % (path, lineno, line)) + # return exit("you forgot a pdb in your python code") + # # bare except clause (now provided by flake8-blind-except plugin) + # if "except:" in line and not line.endswith("# NOQA"): + # print("%s:%s %s" % (path, lineno, line)) + # return exit("bare except clause") # Python linters if py_files: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/scripts/internal/print_announce.py new/psutil-5.9.2/scripts/internal/print_announce.py --- old/psutil-5.9.1/scripts/internal/print_announce.py 2022-05-16 10:33:36.000000000 +0200 +++ new/psutil-5.9.2/scripts/internal/print_announce.py 2022-09-02 12:06:38.000000000 +0200 @@ -83,7 +83,7 @@ block = [] # eliminate the part preceding the first block - for i, line in enumerate(lines): + for line in lines: line = lines.pop(0) if line.startswith('===='): break @@ -92,10 +92,8 @@ for i, line in enumerate(lines): line = lines.pop(0) line = line.rstrip() - if re.match(r"^- \d+_: ", line): - num, _, rest = line.partition(': ') - num = ''.join([x for x in num if x.isdigit()]) - line = "- #%s: %s" % (num, rest) + if re.match(r"^- \d+_", line): + line = re.sub(r"^- (\d+)_", r"- #\1", line) if line.startswith('===='): break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/scripts/internal/tidelift.py new/psutil-5.9.2/scripts/internal/tidelift.py --- old/psutil-5.9.1/scripts/internal/tidelift.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/scripts/internal/tidelift.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Update news entry of Tidelift with latest HISTORY.rst section. -Put your Tidelift API token in a file first: -~/.tidelift.token -""" - -from __future__ import print_function - -import os - -import requests - -import psutil -from psutil.tests import import_module_by_path - - -def upload_relnotes(package, version, text, token): - url = "https://api.tidelift.com/external-api/" + \ - "lifting/pypi/%s/release-notes/%s" % (package, version) - res = requests.put( - url=url, - data=text.encode('utf8'), - headers={"Authorization": "Bearer: %s" % token}) - print(version, res.status_code, res.text) - res.raise_for_status() - - -def main(): - here = os.path.abspath(os.path.dirname(__file__)) - path = os.path.join(here, "print_announce.py") - get_changes = import_module_by_path(path).get_changes - with open(os.path.expanduser("~/.tidelift.token")) as f: - token = f.read().strip() - upload_relnotes('psutil', psutil.__version__, get_changes(), token) - - -if __name__ == "__main__": - main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psutil-5.9.1/scripts/internal/winmake.py new/psutil-5.9.2/scripts/internal/winmake.py --- old/psutil-5.9.1/scripts/internal/winmake.py 2022-05-16 14:04:03.000000000 +0200 +++ new/psutil-5.9.2/scripts/internal/winmake.py 2022-09-02 12:06:38.000000000 +0200 @@ -41,15 +41,21 @@ DEPS = [ "coverage", "flake8", + "flake8-blind-except", + "flake8-debugger", + "flake8-print", "nose", "pdbpp", "pip", "pyperf", "pyreadline", + "requests", "setuptools", "wheel", - "requests" ] + +if sys.version_info[:2] >= (3, 5): + DEPS.append('flake8-bugbear') if sys.version_info[:2] <= (2, 7): DEPS.append('mock') if sys.version_info[:2] <= (3, 2):