-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path19_sysinfo.ring
More file actions
50 lines (43 loc) · 1.03 KB
/
19_sysinfo.ring
File metadata and controls
50 lines (43 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
19 - System Information
Gather system info using Python's platform, os, and sys modules.
*/
load "python.ring"
py_init()
py_exec("
import platform
import sys
import os
info = {
'system': platform.system(),
'release': platform.release(),
'machine': platform.machine(),
'processor': platform.processor() or 'N/A',
'python_ver': platform.python_version(),
'node': platform.node(),
'py_impl': platform.python_implementation(),
'py_path': sys.executable,
'cpu_count': os.cpu_count(),
'cwd': os.getcwd(),
'pid': os.getpid(),
}
")
info = py_get("info")
? "=== System Information ==="
for pair in info
if islist(pair) and len(pair) = 2
? " " + pair[1] + ": " + pair[2]
ok
next
# Environment variables
? ""
? "=== Environment (first 10) ==="
py_exec("
_env = [(k, v[:60]) for k, v in sorted(os.environ.items())[:10]]
")
env = py_get("_env")
for pair in env
if islist(pair) and len(pair) = 2
? " " + pair[1] + " = " + pair[2]
ok
next