Blame SOURCES/0000-update-for-pytest-7.2.0.patch

rdobuilder 686c2a
diff -U4 -r dumb-init-1.2.5--orig/testing/__init__.py dumb-init-1.2.5--patched/testing/__init__.py
rdobuilder 686c2a
--- dumb-init-1.2.5--orig/testing/__init__.py	2020-12-10 19:55:42.000000000 +0100
rdobuilder 686c2a
+++ dumb-init-1.2.5--patched/testing/__init__.py	2022-11-12 02:42:07.751248222 +0100
rdobuilder 686c2a
@@ -7,11 +7,8 @@
rdobuilder 686c2a
 from contextlib import contextmanager
rdobuilder 686c2a
 from subprocess import PIPE
rdobuilder 686c2a
 from subprocess import Popen
rdobuilder 686c2a
 
rdobuilder 686c2a
-from py._path.local import LocalPath
rdobuilder 686c2a
-
rdobuilder 686c2a
-
rdobuilder 686c2a
 # these signals cause dumb-init to suspend itself
rdobuilder 686c2a
 SUSPEND_SIGNALS = frozenset([
rdobuilder 686c2a
     signal.SIGTSTP,
rdobuilder 686c2a
     signal.SIGTTOU,
rdobuilder 686c2a
@@ -48,16 +45,17 @@
rdobuilder 686c2a
 
rdobuilder 686c2a
 def child_pids(pid):
rdobuilder 686c2a
     """Return a list of direct child PIDs for the given PID."""
rdobuilder 686c2a
     children = set()
rdobuilder 686c2a
-    for p in LocalPath('/proc').listdir():
rdobuilder 686c2a
+    for p in os.listdir('/proc'):
rdobuilder 686c2a
         try:
rdobuilder 686c2a
-            stat = open(p.join('stat').strpath).read()
rdobuilder 686c2a
+            with open(os.path.join('/proc', p, 'stat')) as f:
rdobuilder 686c2a
+                stat = f.read()
rdobuilder 686c2a
             m = re.match(r'^\d+ \(.+?\) [a-zA-Z] (\d+) ', stat)
rdobuilder 686c2a
             assert m, stat
rdobuilder 686c2a
             ppid = int(m.group(1))
rdobuilder 686c2a
             if ppid == pid:
rdobuilder 686c2a
-                children.add(int(p.basename))
rdobuilder 686c2a
+                children.add(int(p))
rdobuilder 686c2a
         except OSError:
rdobuilder 686c2a
             # Happens when the process exits after listing it, or between
rdobuilder 686c2a
             # opening stat and reading it.
rdobuilder 686c2a
             pass
rdobuilder 686c2a
@@ -75,14 +73,15 @@
rdobuilder 686c2a
 
rdobuilder 686c2a
 
rdobuilder 686c2a
 def is_alive(pid):
rdobuilder 686c2a
     """Return whether a process is running with the given PID."""
rdobuilder 686c2a
-    return LocalPath('/proc').join(str(pid)).isdir()
rdobuilder 686c2a
+    return os.path.isdir(os.path.join('/proc', str(pid)))
rdobuilder 686c2a
 
rdobuilder 686c2a
 
rdobuilder 686c2a
 def process_state(pid):
rdobuilder 686c2a
     """Return a process' state, such as "stopped" or "running"."""
rdobuilder 686c2a
-    status = LocalPath('/proc').join(str(pid), 'status').read()
rdobuilder 686c2a
+    with open(os.path.join('/proc', str(pid), 'status')) as f:
rdobuilder 686c2a
+        status = f.read()
rdobuilder 686c2a
     m = re.search(r'^State:\s+[A-Z] \(([a-z]+)\)$', status, re.MULTILINE)
rdobuilder 686c2a
     return m.group(1)
rdobuilder 686c2a
 
rdobuilder 686c2a
 
rdobuilder 686c2a
Only in dumb-init-1.2.5--patched/testing: __init__.py.orig