Add reload function to perf.sysctl.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 11 Jun 2024 14:09:50 +0000 (16:09 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 11 Jun 2024 14:09:50 +0000 (16:09 +0200)
pdm/perf.py

index 7aef95a..7c93c85 100644 (file)
@@ -278,4 +278,12 @@ sysinfo["uname"] = simpleattr(func = os.uname)
 sysinfo["hostname"] = simpleattr(func = socket.gethostname)
 sysinfo["platform"] = valueattr(init = sys.platform)
 
-sysctl = simplefunc(exit=lambda status=0: os._exit(status))
+def reload(modname):
+    mod = sys.modules.get(modname)
+    if mod is None:
+        raise ValueError(modname)
+    import importlib
+    importlib.reload(mod)
+
+sysctl = simplefunc(exit=lambda status=0: os._exit(status),
+                    reload=reload)