Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/psutil/files/, dev-python/psutil/
Date: Tue, 22 Feb 2022 09:38:34
Message-Id: 1645522704.78d7db39b5de8a185ff9785513ca745e69d835fe.mgorny@gentoo
1 commit: 78d7db39b5de8a185ff9785513ca745e69d835fe
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 22 09:26:11 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 22 09:38:24 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78d7db39
7
8 dev-python/psutil: Bump to 5.9.0
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/psutil/Manifest | 1 +
13 dev-python/psutil/files/psutil-5.9.0-tests.patch | 188 +++++++++++++++++++++++
14 dev-python/psutil/psutil-5.9.0.ebuild | 45 ++++++
15 3 files changed, 234 insertions(+)
16
17 diff --git a/dev-python/psutil/Manifest b/dev-python/psutil/Manifest
18 index 5990e841b32f..a8eb6c71de71 100644
19 --- a/dev-python/psutil/Manifest
20 +++ b/dev-python/psutil/Manifest
21 @@ -1 +1,2 @@
22 DIST psutil-5.7.3.tar.gz 465556 BLAKE2B 6a9f31fcba571f381c1f4c904a9ff65659d13ed64e91df478aa7df4dabb87a35c4fbd9c0491a3d10b9eaf0fdcc8f2407fcf7144e729043eda605dfe6e6f93844 SHA512 8fcff56dd4e4c1b877c09023721e6f562424f7f84ae5304d518976a1e7f21dd026772f1abfc063bdd0857a375bc869f42febde090dc0b65918d1ebf44e3ad71d
23 +DIST psutil-5.9.0.tar.gz 478322 BLAKE2B 763c8ae14ae546bed64a360047d2ce38783e9e7e939160f751c4ccc94b8e023aaa4cdca426f584e05dae8b1326333660e216d7cb3edd820e24a931dddfa5160f SHA512 b521cfce51e90fdf87ba19bf8069877e3210aede92c17460ea0b00324a36e133168e4bff550462d07ab6d93c597c6560d68954340031ff43168d54a8e5d4c4e7
24
25 diff --git a/dev-python/psutil/files/psutil-5.9.0-tests.patch b/dev-python/psutil/files/psutil-5.9.0-tests.patch
26 new file mode 100644
27 index 000000000000..56a5e1168733
28 --- /dev/null
29 +++ b/dev-python/psutil/files/psutil-5.9.0-tests.patch
30 @@ -0,0 +1,188 @@
31 +diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
32 +index 21bb3e61..6c45c9e0 100644
33 +--- a/psutil/tests/__init__.py
34 ++++ b/psutil/tests/__init__.py
35 +@@ -88,6 +88,7 @@ __all__ = [
36 + "HAS_IONICE", "HAS_MEMORY_MAPS", "HAS_PROC_CPU_NUM", "HAS_RLIMIT",
37 + "HAS_SENSORS_BATTERY", "HAS_BATTERY", "HAS_SENSORS_FANS",
38 + "HAS_SENSORS_TEMPERATURES", "HAS_MEMORY_FULL_INFO",
39 ++ "GENTOO_TESTING",
40 + # subprocesses
41 + 'pyrun', 'terminate', 'reap_children', 'spawn_testproc', 'spawn_zombie',
42 + 'spawn_children_pair',
43 +@@ -128,6 +129,7 @@ PYPY = '__pypy__' in sys.builtin_module_names
44 + APPVEYOR = 'APPVEYOR' in os.environ
45 + GITHUB_ACTIONS = 'GITHUB_ACTIONS' in os.environ or 'CIBUILDWHEEL' in os.environ
46 + CI_TESTING = APPVEYOR or GITHUB_ACTIONS
47 ++GENTOO_TESTING = "GENTOO_TESTING" in os.environ
48 + # are we a 64 bit process?
49 + IS_64BIT = sys.maxsize > 2 ** 32
50 +
51 +diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
52 +index 20e28d29..ce5d10a0 100755
53 +--- a/psutil/tests/test_linux.py
54 ++++ b/psutil/tests/test_linux.py
55 +@@ -28,6 +28,7 @@ from psutil._compat import PY3
56 + from psutil._compat import FileNotFoundError
57 + from psutil._compat import basestring
58 + from psutil._compat import u
59 ++from psutil.tests import GENTOO_TESTING
60 + from psutil.tests import GITHUB_ACTIONS
61 + from psutil.tests import GLOBAL_TIMEOUT
62 + from psutil.tests import HAS_BATTERY
63 +@@ -929,6 +930,7 @@ class TestLoadAvg(PsutilTestCase):
64 + @unittest.skipIf(not LINUX, "LINUX only")
65 + class TestSystemNetIfAddrs(PsutilTestCase):
66 +
67 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
68 + def test_ips(self):
69 + for name, addrs in psutil.net_if_addrs().items():
70 + for addr in addrs:
71 +@@ -1491,6 +1493,7 @@ class TestMisc(PsutilTestCase):
72 + psutil.PROCFS_PATH = "/proc"
73 +
74 + @retry_on_failure()
75 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
76 + def test_issue_687(self):
77 + # In case of thread ID:
78 + # - pid_exists() is supposed to return False
79 +@@ -1596,6 +1599,8 @@ class TestSensorsBattery(PsutilTestCase):
80 + self.assertEqual(psutil.sensors_battery().power_plugged, False)
81 + assert m.called
82 +
83 ++ @unittest.skipIf(GENTOO_TESTING,
84 ++ "mocking doesn't work with non-BAT0 battery")
85 + def test_emulate_power_undetermined(self):
86 + # Pretend we can't know whether the AC power cable not
87 + # connected (assert fallback to False).
88 +@@ -1614,6 +1619,8 @@ class TestSensorsBattery(PsutilTestCase):
89 + self.assertIsNone(psutil.sensors_battery().power_plugged)
90 + assert m.called
91 +
92 ++ @unittest.skipIf(GENTOO_TESTING,
93 ++ "mocking doesn't work with non-BAT0 battery")
94 + def test_emulate_energy_full_0(self):
95 + # Emulate a case where energy_full files returns 0.
96 + with mock_open_content(
97 +@@ -1621,6 +1628,8 @@ class TestSensorsBattery(PsutilTestCase):
98 + self.assertEqual(psutil.sensors_battery().percent, 0)
99 + assert m.called
100 +
101 ++ @unittest.skipIf(GENTOO_TESTING,
102 ++ "mocking doesn't work with non-BAT0 battery")
103 + def test_emulate_energy_full_not_avail(self):
104 + # Emulate a case where energy_full file does not exist.
105 + # Expected fallback on /capacity.
106 +@@ -1634,6 +1643,8 @@ class TestSensorsBattery(PsutilTestCase):
107 + "/sys/class/power_supply/BAT0/capacity", b"88"):
108 + self.assertEqual(psutil.sensors_battery().percent, 88)
109 +
110 ++ @unittest.skipIf(GENTOO_TESTING,
111 ++ "mocking doesn't work with non-BAT0 battery")
112 + def test_emulate_no_power(self):
113 + # Emulate a case where /AC0/online file nor /BAT0/status exist.
114 + with mock_open_exception(
115 +@@ -2220,6 +2231,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
116 + value = self.read_status_file("nonvoluntary_ctxt_switches:")
117 + self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
118 +
119 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
120 + def test_cpu_affinity(self):
121 + value = self.read_status_file("Cpus_allowed_list:")
122 + if '-' in str(value):
123 +diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py
124 +index d946eb62..a53de565 100755
125 +--- a/psutil/tests/test_misc.py
126 ++++ b/psutil/tests/test_misc.py
127 +@@ -32,6 +32,7 @@ from psutil._compat import PY3
128 + from psutil._compat import redirect_stderr
129 + from psutil.tests import APPVEYOR
130 + from psutil.tests import CI_TESTING
131 ++from psutil.tests import GENTOO_TESTING
132 + from psutil.tests import HAS_BATTERY
133 + from psutil.tests import HAS_MEMORY_MAPS
134 + from psutil.tests import HAS_NET_IO_COUNTERS
135 +@@ -401,6 +402,7 @@ class TestMisc(PsutilTestCase):
136 + reload_module(psutil)
137 + self.assertIn("version conflict", str(cm.exception).lower())
138 +
139 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
140 + def test_debug(self):
141 + if PY3:
142 + from io import StringIO
143 +diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py
144 +index 31b81926..7eb9bac5 100755
145 +--- a/psutil/tests/test_posix.py
146 ++++ b/psutil/tests/test_posix.py
147 +@@ -23,6 +23,7 @@ from psutil import OPENBSD
148 + from psutil import POSIX
149 + from psutil import SUNOS
150 + from psutil.tests import CI_TESTING
151 ++from psutil.tests import GENTOO_TESTING
152 + from psutil.tests import HAS_NET_IO_COUNTERS
153 + from psutil.tests import PYTHON_EXE
154 + from psutil.tests import PsutilTestCase
155 +@@ -326,6 +327,7 @@ class TestSystemAPIs(PsutilTestCase):
156 + "couldn't find %s nic in 'ifconfig -a' output\n%s" % (
157 + nic, output))
158 +
159 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
160 + @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
161 + @retry_on_failure()
162 + def test_users(self):
163 +diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
164 +index c9059e33..0050c42a 100755
165 +--- a/psutil/tests/test_process.py
166 ++++ b/psutil/tests/test_process.py
167 +@@ -38,6 +38,7 @@ from psutil._compat import long
168 + from psutil._compat import super
169 + from psutil.tests import APPVEYOR
170 + from psutil.tests import CI_TESTING
171 ++from psutil.tests import GENTOO_TESTING
172 + from psutil.tests import GITHUB_ACTIONS
173 + from psutil.tests import GLOBAL_TIMEOUT
174 + from psutil.tests import HAS_CPU_AFFINITY
175 +@@ -292,6 +293,7 @@ class TestProcess(PsutilTestCase):
176 + time.strftime("%Y %m %d %H:%M:%S", time.localtime(p.create_time()))
177 +
178 + @unittest.skipIf(not POSIX, 'POSIX only')
179 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
180 + def test_terminal(self):
181 + terminal = psutil.Process().terminal()
182 + if terminal is not None:
183 +@@ -341,6 +343,7 @@ class TestProcess(PsutilTestCase):
184 + self.assertGreaterEqual(io2[i], 0)
185 + self.assertGreaterEqual(io2[i], 0)
186 +
187 ++ @unittest.skipIf(GENTOO_TESTING, "fails if builder is ioniced already")
188 + @unittest.skipIf(not HAS_IONICE, "not supported")
189 + @unittest.skipIf(not LINUX, "linux only")
190 + def test_ionice_linux(self):
191 +@@ -1406,6 +1409,7 @@ class TestProcess(PsutilTestCase):
192 + if not OSX and GITHUB_ACTIONS:
193 + self.assertEqual(d1, d2)
194 +
195 ++ @unittest.skipIf(GENTOO_TESTING, "broken by Gentoo sandbox")
196 + @unittest.skipIf(not HAS_ENVIRON, "not supported")
197 + @unittest.skipIf(not POSIX, "POSIX only")
198 + def test_weird_environ(self):
199 +diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
200 +index db2cb348..b1faa154 100755
201 +--- a/psutil/tests/test_system.py
202 ++++ b/psutil/tests/test_system.py
203 +@@ -33,6 +33,7 @@ from psutil._compat import long
204 + from psutil.tests import ASCII_FS
205 + from psutil.tests import CI_TESTING
206 + from psutil.tests import DEVNULL
207 ++from psutil.tests import GENTOO_TESTING
208 + from psutil.tests import GITHUB_ACTIONS
209 + from psutil.tests import GLOBAL_TIMEOUT
210 + from psutil.tests import HAS_BATTERY
211 +@@ -199,6 +200,7 @@ class TestMiscAPIs(PsutilTestCase):
212 + self.assertGreater(bt, 0)
213 + self.assertLess(bt, time.time())
214 +
215 ++ @unittest.skipIf(GENTOO_TESTING, "broken in Gentoo test env")
216 + @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
217 + def test_users(self):
218 + users = psutil.users()
219
220 diff --git a/dev-python/psutil/psutil-5.9.0.ebuild b/dev-python/psutil/psutil-5.9.0.ebuild
221 new file mode 100644
222 index 000000000000..00a12bc0d760
223 --- /dev/null
224 +++ b/dev-python/psutil/psutil-5.9.0.ebuild
225 @@ -0,0 +1,45 @@
226 +# Copyright 1999-2022 Gentoo Authors
227 +# Distributed under the terms of the GNU General Public License v2
228 +
229 +EAPI=8
230 +
231 +DISTUTILS_USE_PEP517=setuptools
232 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
233 +
234 +inherit distutils-r1
235 +
236 +DESCRIPTION="Retrieve information on running processes and system utilization"
237 +HOMEPAGE="https://github.com/giampaolo/psutil https://pypi.org/project/psutil/"
238 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
239 +
240 +LICENSE="BSD"
241 +SLOT="0"
242 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
243 +IUSE="test"
244 +RESTRICT="!test? ( test )"
245 +
246 +PATCHES=(
247 + "${FILESDIR}"/psutil-5.9.0-tests.patch
248 +)
249 +
250 +python_test() {
251 + if [[ ${EPYTHON} == pypy* ]]; then
252 + ewarn "Not running tests on ${EPYTHON} since they are broken"
253 + return 0
254 + fi
255 +
256 + # since we are running in an environment a bit similar to CI,
257 + # let's skip the tests that are disable for CI
258 + local -x TRAVIS=1
259 + local -x APPVEYOR=1
260 + local -x GITHUB_ACTIONS=1
261 + local -x GENTOO_TESTING=1
262 + "${EPYTHON}" psutil/tests/runner.py ||
263 + die "tests failed with ${EPYTHON}"
264 +}
265 +
266 +python_compile() {
267 + # force -j1 to avoid .o linking race conditions
268 + local MAKEOPTS=-j1
269 + distutils-r1_python_compile
270 +}