From e2e2ced49d2b6087b5d0a720d252c360214a1a2e Mon Sep 17 00:00:00 2001 From: purplerain Date: Tue, 12 Sep 2023 03:36:48 +0000 Subject: [PATCH] make sysutils/py-psutil build on SecBSD --- sysutils/py-psutil/Makefile | 2 +- .../patches/patch-psutil___init___py | 29 ++++ .../py-psutil/patches/patch-psutil__common_py | 23 ++++ .../py-psutil/patches/patch-psutil__psbsd_py | 127 ++++++++++++++++++ .../patches/patch-psutil_tests_test_bsd_py | 29 ++++ .../patch-psutil_tests_test_connections_py | 29 ++++ .../patch-psutil_tests_test_contracts_py | 47 +++++++ .../patch-psutil_tests_test_memleaks_py | 29 ++++ .../patches/patch-psutil_tests_test_posix_py | 20 +++ .../patch-psutil_tests_test_process_py | 74 ++++++++++ .../patches/patch-psutil_tests_test_system_py | 51 +++++++ .../patch-psutil_tests_test_unicode_py | 29 ++++ .../py-psutil/patches/patch-pyproject_toml | 11 ++ sysutils/py-psutil/patches/patch-setup_py | 29 ++++ sysutils/py-psutil/pkg/PLIST | 2 - 15 files changed, 528 insertions(+), 3 deletions(-) create mode 100644 sysutils/py-psutil/patches/patch-psutil___init___py create mode 100644 sysutils/py-psutil/patches/patch-psutil__common_py create mode 100644 sysutils/py-psutil/patches/patch-psutil__psbsd_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_bsd_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_connections_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_contracts_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_memleaks_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_posix_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_process_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_system_py create mode 100644 sysutils/py-psutil/patches/patch-psutil_tests_test_unicode_py create mode 100644 sysutils/py-psutil/patches/patch-pyproject_toml create mode 100644 sysutils/py-psutil/patches/patch-setup_py diff --git a/sysutils/py-psutil/Makefile b/sysutils/py-psutil/Makefile index 245c02df0..75b9628d7 100644 --- a/sysutils/py-psutil/Makefile +++ b/sysutils/py-psutil/Makefile @@ -22,7 +22,7 @@ MODPY_PYBUILD = setuptools FLAVORS = python3 FLAVOR = python3 -MODPY_PYTEST_ARGS = lib*/psutil/tests +MODPY_PYTEST_ARGS = lib/psutil/tests TEST_DEPENDS = devel/py-mock${MODPY_FLAVOR} .include diff --git a/sysutils/py-psutil/patches/patch-psutil___init___py b/sysutils/py-psutil/patches/patch-psutil___init___py new file mode 100644 index 000000000..bea881452 --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil___init___py @@ -0,0 +1,29 @@ +Index: psutil/__init__.py +--- psutil/__init__.py.orig ++++ psutil/__init__.py +@@ -66,6 +66,7 @@ from ._common import OSX # deprecated alias + from ._common import POSIX # NOQA + from ._common import POWER_TIME_UNKNOWN + from ._common import POWER_TIME_UNLIMITED ++from ._common import SECBSD # NOQA + from ._common import STATUS_DEAD + from ._common import STATUS_DISK_SLEEP + from ._common import STATUS_IDLE +@@ -170,7 +171,7 @@ __all__ = [ + "POWER_TIME_UNKNOWN", "POWER_TIME_UNLIMITED", + + "BSD", "FREEBSD", "LINUX", "NETBSD", "OPENBSD", "MACOS", "OSX", "POSIX", +- "SUNOS", "WINDOWS", "AIX", ++ "SECBSD", "SUNOS", "WINDOWS", "AIX", + + # "RLIM_INFINITY", "RLIMIT_AS", "RLIMIT_CORE", "RLIMIT_CPU", "RLIMIT_DATA", + # "RLIMIT_FSIZE", "RLIMIT_LOCKS", "RLIMIT_MEMLOCK", "RLIMIT_NOFILE", +@@ -1179,7 +1180,7 @@ class Process(object): + try: + os.kill(self.pid, sig) + except ProcessLookupError: +- if OPENBSD and pid_exists(self.pid): ++ if OPENBSD or SECBSD and pid_exists(self.pid): + # We do this because os.kill() lies in case of + # zombie processes. + raise ZombieProcess(self.pid, self._name, self._ppid) diff --git a/sysutils/py-psutil/patches/patch-psutil__common_py b/sysutils/py-psutil/patches/patch-psutil__common_py new file mode 100644 index 000000000..9eea7adcd --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil__common_py @@ -0,0 +1,23 @@ +Index: psutil/_common.py +--- psutil/_common.py.orig ++++ psutil/_common.py +@@ -49,7 +49,7 @@ _DEFAULT = object() + __all__ = [ + # OS constants + 'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'MACOS', 'OSX', 'POSIX', +- 'SUNOS', 'WINDOWS', ++ 'SECBSD', 'SUNOS', 'WINDOWS', + # connection constants + 'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED', + 'CONN_FIN_WAIT1', 'CONN_FIN_WAIT2', 'CONN_LAST_ACK', 'CONN_LISTEN', +@@ -90,8 +90,9 @@ MACOS = sys.platform.startswith("darwin") + OSX = MACOS # deprecated alias + FREEBSD = sys.platform.startswith(("freebsd", "midnightbsd")) + OPENBSD = sys.platform.startswith("openbsd") ++SECBSD = sys.platform.startswith("secbsd") + NETBSD = sys.platform.startswith("netbsd") +-BSD = FREEBSD or OPENBSD or NETBSD ++BSD = FREEBSD or OPENBSD or SECBSD or NETBSD + SUNOS = sys.platform.startswith(("sunos", "solaris")) + AIX = sys.platform.startswith("aix") + diff --git a/sysutils/py-psutil/patches/patch-psutil__psbsd_py b/sysutils/py-psutil/patches/patch-psutil__psbsd_py new file mode 100644 index 000000000..ed66e702e --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil__psbsd_py @@ -0,0 +1,127 @@ +Index: psutil/_psbsd.py +--- psutil/_psbsd.py.orig ++++ psutil/_psbsd.py +@@ -2,7 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-"""FreeBSD, OpenBSD and NetBSD platforms implementation.""" ++"""FreeBSD, OpenBSD, SecBSD and NetBSD platforms implementation.""" + + import contextlib + import errno +@@ -19,6 +19,7 @@ from . import _psutil_posix as cext_posix + from ._common import FREEBSD + from ._common import NETBSD + from ._common import OPENBSD ++from ._common import SECBSD + from ._common import AccessDenied + from ._common import NoSuchProcess + from ._common import ZombieProcess +@@ -51,7 +52,7 @@ if FREEBSD: + cext.SWAIT: _common.STATUS_WAITING, + cext.SLOCK: _common.STATUS_LOCKED, + } +-elif OPENBSD: ++elif OPENBSD or SECBSD: + PROC_STATUSES = { + cext.SIDL: _common.STATUS_IDLE, + cext.SSLEEP: _common.STATUS_SLEEPING, +@@ -250,7 +251,7 @@ def cpu_count_logical(): + return cext.cpu_count_logical() + + +-if OPENBSD or NETBSD: ++if OPENBSD or NETBSD or SECBSD: + def cpu_count_cores(): + # OpenBSD and NetBSD do not implement this. + return 1 if cpu_count_logical() == 1 else None +@@ -304,7 +305,7 @@ def cpu_stats(): + for line in f: + if line.startswith(b'intr'): + intrs = int(line.split()[1]) +- elif OPENBSD: ++ elif OPENBSD or SECBSD: + # Note: the C ext is returning some metrics we are not exposing: + # traps, faults and forks. + ctxsw, intrs, soft_intrs, syscalls, traps, faults, forks = \ +@@ -336,7 +337,7 @@ if FREEBSD: + max_freq = None + ret.append(_common.scpufreq(current, min_freq, max_freq)) + return ret +-elif OPENBSD: ++elif OPENBSD or SECBSD: + def cpu_freq(): + curr = float(cext.cpu_freq()) + return [_common.scpufreq(curr, 0.0, 0.0)] +@@ -401,7 +402,7 @@ def net_if_stats(): + + def net_connections(kind): + """System-wide network connections.""" +- if OPENBSD: ++ if OPENBSD or SECBSD: + ret = [] + for pid in pids(): + try: +@@ -492,7 +493,7 @@ def users(): + for item in rawlist: + user, tty, hostname, tstamp, pid = item + if pid == -1: +- assert OPENBSD ++ assert SECBSD + pid = None + if tty == '~': + continue # reboot or shutdown +@@ -521,14 +522,14 @@ def _pid_0_exists(): + def pids(): + """Returns a list of PIDs currently running on the system.""" + ret = cext.pids() +- if OPENBSD and (0 not in ret) and _pid_0_exists(): ++ if SECBSD and (0 not in ret) and _pid_0_exists(): + # On OpenBSD the kernel does not return PID 0 (neither does + # ps) but it's actually querable (Process(0) will succeed). + ret.insert(0, 0) + return ret + + +-if OPENBSD or NETBSD: ++if OPENBSD or NETBSD or SECBSD: + def pid_exists(pid): + """Return True if pid exists.""" + exists = _psposix.pid_exists(pid) +@@ -653,7 +654,7 @@ class Process(object): + + @wrap_exceptions + def cmdline(self): +- if OPENBSD and self.pid == 0: ++ if SECBSD and self.pid == 0: + return [] # ...else it crashes + elif NETBSD: + # XXX - most of the times the underlying sysctl() call on Net +@@ -764,7 +765,7 @@ class Process(object): + for thread_id, utime, stime in rawlist: + ntuple = _common.pthread(thread_id, utime, stime) + retlist.append(ntuple) +- if OPENBSD: ++ if OPENBSD or SECBSD: + self._assert_alive() + return retlist + +@@ -797,7 +798,7 @@ class Process(object): + TCP_STATUSES) + ret.append(nt) + +- if OPENBSD: ++ if OPENBSD or SECBSD: + self._assert_alive() + + return ret +@@ -834,7 +835,7 @@ class Process(object): + """Return process current working directory.""" + # sometimes we get an empty string, in which case we turn + # it into None +- if OPENBSD and self.pid == 0: ++ if SECBSD and self.pid == 0: + return None # ...else it would raise EINVAL + elif NETBSD or HAS_PROC_OPEN_FILES: + # FreeBSD < 8 does not support functions based on diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_bsd_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_bsd_py new file mode 100644 index 000000000..fdd0f935d --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_bsd_py @@ -0,0 +1,29 @@ +Index: psutil/tests/test_bsd.py +--- psutil/tests/test_bsd.py.orig ++++ psutil/tests/test_bsd.py +@@ -21,6 +21,7 @@ from psutil import BSD + from psutil import FREEBSD + from psutil import NETBSD + from psutil import OPENBSD ++from psutil import SECBSD + from psutil.tests import HAS_BATTERY + from psutil.tests import TOLERANCE_SYS_MEM + from psutil.tests import PsutilTestCase +@@ -49,7 +50,7 @@ def sysctl(cmdline): + result = sh("sysctl " + cmdline) + if FREEBSD: + result = result[result.find(": ") + 2:] +- elif OPENBSD or NETBSD: ++ elif OPENBSD or NETBSD or SECBSD: + result = result[result.find("=") + 1:] + try: + return int(result) +@@ -481,7 +482,7 @@ class FreeBSDSystemTestCase(PsutilTestCase): + # ===================================================================== + + +-@unittest.skipIf(not OPENBSD, "OPENBSD only") ++@unittest.skipIf(not (OPENBSD or SECBSD), "OPENBSD only") + class OpenBSDTestCase(PsutilTestCase): + + def test_boot_time(self): diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_connections_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_connections_py new file mode 100644 index 000000000..be3cf43dd --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_connections_py @@ -0,0 +1,29 @@ +Index: psutil/tests/test_connections.py +--- psutil/tests/test_connections.py.orig ++++ psutil/tests/test_connections.py +@@ -23,6 +23,7 @@ from psutil import MACOS + from psutil import NETBSD + from psutil import OPENBSD + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil import WINDOWS + from psutil._common import supports_ipv6 +@@ -143,7 +144,7 @@ class TestUnconnectedSockets(ConnectionTestCase): + laddr = laddr.decode() + if sock.family == AF_INET6: + laddr = laddr[:2] +- if sock.family == AF_UNIX and OPENBSD: ++ if sock.family == AF_UNIX and (OPENBSD or SECBSD): + # No addresses are set for UNIX sockets on OpenBSD. + pass + else: +@@ -249,7 +250,7 @@ class TestConnectedSocket(ConnectionTestCase): + self.assertEqual(cons[1].raddr, "") + # one local address should though + self.assertEqual(testfn, cons[0].laddr or cons[1].laddr) +- elif OPENBSD: ++ elif OPENBSD or SECBSD: + # No addresses whatsoever here. + for addr in (cons[0].laddr, cons[0].raddr, + cons[1].laddr, cons[1].raddr): diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_contracts_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_contracts_py new file mode 100644 index 000000000..a156d265b --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_contracts_py @@ -0,0 +1,47 @@ +Index: psutil/tests/test_contracts.py +--- psutil/tests/test_contracts.py.orig ++++ psutil/tests/test_contracts.py +@@ -30,6 +30,7 @@ from psutil import NETBSD + from psutil import OPENBSD + from psutil import OSX + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil import WINDOWS + from psutil._compat import FileNotFoundError +@@ -136,7 +137,7 @@ class TestAvailSystemAPIs(PsutilTestCase): + + def test_cpu_freq(self): + self.assertEqual(hasattr(psutil, "cpu_freq"), +- LINUX or MACOS or WINDOWS or FREEBSD or OPENBSD) ++ LINUX or MACOS or WINDOWS or FREEBSD or OPENBSD or SECBSD) + + def test_sensors_temperatures(self): + self.assertEqual( +@@ -155,7 +156,7 @@ class TestAvailProcessAPIs(PsutilTestCase): + def test_environ(self): + self.assertEqual(hasattr(psutil.Process, "environ"), + LINUX or MACOS or WINDOWS or AIX or SUNOS or +- FREEBSD or OPENBSD or NETBSD) ++ FREEBSD or OPENBSD or NETBSD or SECBSD) + + def test_uids(self): + self.assertEqual(hasattr(psutil.Process, "uids"), POSIX) +@@ -195,7 +196,7 @@ class TestAvailProcessAPIs(PsutilTestCase): + def test_memory_maps(self): + hasit = hasattr(psutil.Process, "memory_maps") + self.assertEqual( +- hasit, False if OPENBSD or NETBSD or AIX or MACOS else True) ++ hasit, False if OPENBSD or SECBSD or NETBSD or AIX or MACOS else True) + + + # =================================================================== +@@ -494,7 +495,7 @@ class TestFetchAllProcesses(PsutilTestCase): + self.assertGreaterEqual(ret, 0) + except AssertionError: + # XXX +- if OPENBSD and info['status'] == psutil.STATUS_ZOMBIE: ++ if (OPENBSD or SECBSD) and info['status'] == psutil.STATUS_ZOMBIE: + pass + else: + raise diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_memleaks_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_memleaks_py new file mode 100644 index 000000000..574cf207f --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_memleaks_py @@ -0,0 +1,29 @@ +Index: psutil/tests/test_memleaks.py +--- psutil/tests/test_memleaks.py.orig ++++ psutil/tests/test_memleaks.py +@@ -28,6 +28,7 @@ from psutil import LINUX + from psutil import MACOS + from psutil import OPENBSD + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil import WINDOWS + from psutil._compat import ProcessLookupError +@@ -160,7 +161,7 @@ class TestProcessObjectLeaks(TestMemoryLeak): + self.execute(self.proc.create_time) + + @fewtimes_if_linux() +- @skip_on_access_denied(only_if=OPENBSD) ++ @skip_on_access_denied(only_if=SECBSD) + def test_num_threads(self): + self.execute(self.proc.num_threads) + +@@ -178,7 +179,7 @@ class TestProcessObjectLeaks(TestMemoryLeak): + self.execute(self.proc.num_ctx_switches) + + @fewtimes_if_linux() +- @skip_on_access_denied(only_if=OPENBSD) ++ @skip_on_access_denied(only_if=SECBSD) + def test_threads(self): + self.execute(self.proc.threads) + diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_posix_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_posix_py new file mode 100644 index 000000000..e7da283b6 --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_posix_py @@ -0,0 +1,20 @@ +Index: psutil/tests/test_posix.py +--- psutil/tests/test_posix.py.orig ++++ psutil/tests/test_posix.py +@@ -22,6 +22,7 @@ from psutil import LINUX + from psutil import MACOS + from psutil import OPENBSD + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil.tests import CI_TESTING + from psutil.tests import HAS_NET_IO_COUNTERS +@@ -307,7 +308,7 @@ class TestSystemAPIs(PsutilTestCase): + pids_psutil = psutil.pids() + + # on MACOS and OPENBSD ps doesn't show pid 0 +- if MACOS or OPENBSD and 0 not in pids_ps: ++ if MACOS or OPENBSD or SECBSD and 0 not in pids_ps: + pids_ps.insert(0, 0) + + # There will often be one more process in pids_ps for ps itself diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_process_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_process_py new file mode 100644 index 000000000..91815527a --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_process_py @@ -0,0 +1,74 @@ +Index: psutil/tests/test_process.py +--- psutil/tests/test_process.py.orig ++++ psutil/tests/test_process.py +@@ -30,6 +30,7 @@ from psutil import NETBSD + from psutil import OPENBSD + from psutil import OSX + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil import WINDOWS + from psutil._common import open_text +@@ -503,7 +504,7 @@ class TestProcess(PsutilTestCase): + # thread number, since we always have with 1 thread per process, + # but this does not apply across all platforms (MACOS, Windows) + p = psutil.Process() +- if OPENBSD: ++ if OPENBSD or SECBSD: + try: + step1 = p.num_threads() + except psutil.AccessDenied: +@@ -524,7 +525,7 @@ class TestProcess(PsutilTestCase): + @unittest.skipIf(not HAS_THREADS, 'not supported') + def test_threads(self): + p = psutil.Process() +- if OPENBSD: ++ if OPENBSD or SECBSD: + try: + step1 = p.threads() + except psutil.AccessDenied: +@@ -546,7 +547,7 @@ class TestProcess(PsutilTestCase): + @unittest.skipIf(not HAS_THREADS, 'not supported') + def test_threads_2(self): + p = self.spawn_psproc() +- if OPENBSD: ++ if OPENBSD or SECBSD: + try: + p.threads() + except psutil.AccessDenied: +@@ -715,7 +716,7 @@ class TestProcess(PsutilTestCase): + # Also /proc/pid/cmdline behaves the same so it looks + # like this is a kernel bug. + # XXX - AIX truncates long arguments in /proc/pid/cmdline +- if NETBSD or OPENBSD or AIX: ++ if NETBSD or OPENBSD or SECBSD or AIX: + self.assertEqual(p.cmdline()[0], PYTHON_EXE) + else: + if MACOS and CI_TESTING: +@@ -1030,7 +1031,7 @@ class TestProcess(PsutilTestCase): + self.assertEqual(p.num_fds(), start) + + @skip_on_not_implemented(only_if=LINUX) +- @unittest.skipIf(OPENBSD or NETBSD, "not reliable on OPENBSD & NETBSD") ++ @unittest.skipIf(OPENBSD or SECBSD or NETBSD, "not reliable on OPENBSD & NETBSD") + def test_num_ctx_switches(self): + p = psutil.Process() + before = sum(p.num_ctx_switches()) +@@ -1267,7 +1268,7 @@ class TestProcess(PsutilTestCase): + except psutil.NoSuchProcess: + pass + except psutil.AccessDenied: +- if OPENBSD and fun_name in ('threads', 'num_threads'): ++ if (OPENBSD or SECBSD) and fun_name in ('threads', 'num_threads'): + return + raise + else: +@@ -1399,7 +1400,7 @@ class TestProcess(PsutilTestCase): + elif name == "name": + assert name, name + +- if not OPENBSD: ++ if not (OPENBSD or SECBSD): + self.assertIn(0, psutil.pids()) + assert psutil.pid_exists(0) + diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_system_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_system_py new file mode 100644 index 000000000..9a684a12b --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_system_py @@ -0,0 +1,51 @@ +Index: psutil/tests/test_system.py +--- psutil/tests/test_system.py.orig ++++ psutil/tests/test_system.py +@@ -28,6 +28,7 @@ from psutil import MACOS + from psutil import NETBSD + from psutil import OPENBSD + from psutil import POSIX ++from psutil import SECBSD + from psutil import SUNOS + from psutil import WINDOWS + from psutil._compat import FileNotFoundError +@@ -214,7 +215,7 @@ class TestMiscAPIs(PsutilTestCase): + user.host + assert user.started > 0.0, user + datetime.datetime.fromtimestamp(user.started) +- if WINDOWS or OPENBSD: ++ if WINDOWS or OPENBSD or SECBSD: + self.assertIsNone(user.pid) + else: + psutil.Process(user.pid) +@@ -230,7 +231,7 @@ class TestMiscAPIs(PsutilTestCase): + + def test_os_constants(self): + names = ["POSIX", "WINDOWS", "LINUX", "MACOS", "FREEBSD", "OPENBSD", +- "NETBSD", "BSD", "SUNOS"] ++ "SECBSD", "NETBSD", "BSD", "SUNOS"] + for name in names: + self.assertIsInstance(getattr(psutil, name), bool, msg=name) + +@@ -244,10 +245,11 @@ class TestMiscAPIs(PsutilTestCase): + elif "bsd" in sys.platform.lower(): + assert psutil.BSD + self.assertEqual([psutil.FREEBSD, psutil.OPENBSD, +- psutil.NETBSD].count(True), 1) ++ psutil.SECBSD, psutil.NETBSD].count(True), 1) + names.remove("BSD") + names.remove("FREEBSD") + names.remove("OPENBSD") ++ names.remove("SECBSD") + names.remove("NETBSD") + elif "sunos" in sys.platform.lower() or \ + "solaris" in sys.platform.lower(): +@@ -657,7 +659,7 @@ class TestDiskAPIs(PsutilTestCase): + self.assertEqual(nt[1], nt.write_count) + self.assertEqual(nt[2], nt.read_bytes) + self.assertEqual(nt[3], nt.write_bytes) +- if not (OPENBSD or NETBSD): ++ if not (OPENBSD or NETBSD or SECBSD): + self.assertEqual(nt[4], nt.read_time) + self.assertEqual(nt[5], nt.write_time) + if LINUX: diff --git a/sysutils/py-psutil/patches/patch-psutil_tests_test_unicode_py b/sysutils/py-psutil/patches/patch-psutil_tests_test_unicode_py new file mode 100644 index 000000000..cc6149564 --- /dev/null +++ b/sysutils/py-psutil/patches/patch-psutil_tests_test_unicode_py @@ -0,0 +1,29 @@ +Index: psutil/tests/test_unicode.py +--- psutil/tests/test_unicode.py.orig ++++ psutil/tests/test_unicode.py +@@ -84,6 +84,7 @@ import psutil + from psutil import BSD + from psutil import OPENBSD + from psutil import POSIX ++from psutil import SECBSD + from psutil import WINDOWS + from psutil._compat import PY3 + from psutil._compat import u +@@ -258,7 +259,7 @@ class TestFSAPIs(BaseUnicodeTest): + conn = psutil.Process().connections('unix')[0] + self.assertIsInstance(conn.laddr, str) + # AF_UNIX addr not set on OpenBSD +- if not OPENBSD: # XXX ++ if not (OPENBSD or SECBSD): # XXX + self.assertEqual(conn.laddr, name) + + @unittest.skipIf(not POSIX, "POSIX only") +@@ -282,7 +283,7 @@ class TestFSAPIs(BaseUnicodeTest): + with closing(sock): + cons = psutil.net_connections(kind='unix') + # AF_UNIX addr not set on OpenBSD +- if not OPENBSD: ++ if not (OPENBSD or SECBSD): + conn = find_sock(cons) + self.assertIsInstance(conn.laddr, str) + self.assertEqual(conn.laddr, name) diff --git a/sysutils/py-psutil/patches/patch-pyproject_toml b/sysutils/py-psutil/patches/patch-pyproject_toml new file mode 100644 index 000000000..b1f0fad3d --- /dev/null +++ b/sysutils/py-psutil/patches/patch-pyproject_toml @@ -0,0 +1,11 @@ +Index: pyproject.toml +--- pyproject.toml.orig ++++ pyproject.toml +@@ -27,6 +27,7 @@ exclude_lines = [ + "if MACOS", + "if NETBSD", + "if OPENBSD", ++ "if SECBSD", + "if ppid_map is None:", + "if PY3:", + "if SUNOS", diff --git a/sysutils/py-psutil/patches/patch-setup_py b/sysutils/py-psutil/patches/patch-setup_py new file mode 100644 index 000000000..264bb9d0b --- /dev/null +++ b/sysutils/py-psutil/patches/patch-setup_py @@ -0,0 +1,29 @@ +Index: setup.py +--- setup.py.orig ++++ setup.py +@@ -51,6 +51,7 @@ from _common import MACOS # NOQA + from _common import NETBSD # NOQA + from _common import OPENBSD # NOQA + from _common import POSIX # NOQA ++from _common import SECBSD # NOQA + from _common import SUNOS # NOQA + from _common import WINDOWS # NOQA + from _common import hilite # NOQA +@@ -234,7 +235,7 @@ elif FREEBSD: + libraries=["devstat"], + **py_limited_api) + +-elif OPENBSD: ++elif OPENBSD or SECBSD: + macros.append(("PSUTIL_OPENBSD", 1)) + ext = Extension( + 'psutil._psutil_bsd', +@@ -470,7 +471,7 @@ def main(): + missdeps("pkg install gcc python%s" % py3) + elif which('mport'): # MidnightBSD + missdeps("mport install gcc python%s" % py3) +- elif OPENBSD: ++ elif OPENBSD or SECBSD: + missdeps("pkg_add -v gcc python%s" % py3) + elif NETBSD: + missdeps("pkgin install gcc python%s" % py3) diff --git a/sysutils/py-psutil/pkg/PLIST b/sysutils/py-psutil/pkg/PLIST index 8008e3365..96a0c5c2e 100644 --- a/sysutils/py-psutil/pkg/PLIST +++ b/sysutils/py-psutil/pkg/PLIST @@ -72,8 +72,6 @@ lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_proce lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_process.${MODPY_PYC_MAGIC_TAG}pyc lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_sunos.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION} lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_sunos.${MODPY_PYC_MAGIC_TAG}pyc -lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_system.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION} -lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_system.${MODPY_PYC_MAGIC_TAG}pyc lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_testutils.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION} lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_testutils.${MODPY_PYC_MAGIC_TAG}pyc lib/python${MODPY_VERSION}/site-packages/psutil/tests/${MODPY_PYCACHE}test_unicode.${MODPY_PYC_MAGIC_TAG}${MODPY_PYOEXTENSION}