90 lines
2.7 KiB
Python
90 lines
2.7 KiB
Python
import subprocess
|
|
import platform
|
|
import json
|
|
import os
|
|
|
|
def get_system_info():
|
|
info = {}
|
|
|
|
# Basic System Info
|
|
info['os'] = {
|
|
'system': platform.system(),
|
|
'version': platform.mac_ver()[0],
|
|
'architecture': platform.machine()
|
|
}
|
|
|
|
# CPU Info
|
|
cpu_command = "sysctl -n machdep.cpu.brand_string"
|
|
info['cpu'] = subprocess.getoutput(cpu_command)
|
|
|
|
# Memory Info
|
|
mem_command = "sysctl hw.memsize"
|
|
mem_bytes = int(subprocess.getoutput(mem_command).split()[1])
|
|
info['memory_gb'] = mem_bytes / (1024**3)
|
|
|
|
# GPU Info
|
|
gpu_command = "system_profiler SPDisplaysDataType"
|
|
gpu_info = subprocess.getoutput(gpu_command)
|
|
info['gpu'] = gpu_info
|
|
|
|
# Screen Info
|
|
displays_command = "system_profiler SPDisplaysDataType"
|
|
displays_info = subprocess.getoutput(displays_command)
|
|
info['displays'] = displays_info
|
|
|
|
# Xcode Version
|
|
xcode_command = "xcodebuild -version"
|
|
try:
|
|
info['xcode'] = subprocess.getoutput(xcode_command)
|
|
except:
|
|
info['xcode'] = "Xcode not installed"
|
|
|
|
# Swift Version
|
|
swift_command = "swift --version"
|
|
try:
|
|
info['swift'] = subprocess.getoutput(swift_command)
|
|
except:
|
|
info['swift'] = "Swift not installed"
|
|
|
|
# Metal Support
|
|
metal_command = "system_profiler SPDisplaysDataType | grep Metal"
|
|
info['metal_support'] = subprocess.getoutput(metal_command)
|
|
|
|
return info
|
|
|
|
def save_info():
|
|
info = get_system_info()
|
|
|
|
# Save as JSON
|
|
with open('tech_specs.json', 'w') as f:
|
|
json.dump(info, f, indent=2)
|
|
|
|
# Save as readable text
|
|
with open('tech_specs.txt', 'w') as f:
|
|
f.write("Chess Teaching Assistant - Development System Specifications\n")
|
|
f.write("=" * 60 + "\n\n")
|
|
|
|
f.write("Operating System:\n")
|
|
f.write(f"- System: {info['os']['system']}\n")
|
|
f.write(f"- Version: {info['os']['version']}\n")
|
|
f.write(f"- Architecture: {info['os']['architecture']}\n\n")
|
|
|
|
f.write("Hardware:\n")
|
|
f.write(f"- CPU: {info['cpu']}\n")
|
|
f.write(f"- Memory: {info['memory_gb']:.2f} GB\n\n")
|
|
|
|
f.write("Development Tools:\n")
|
|
f.write(f"- Xcode: {info['xcode']}\n")
|
|
f.write(f"- Swift: {info['swift']}\n\n")
|
|
|
|
f.write("Graphics:\n")
|
|
f.write(f"- Metal Support:\n{info['metal_support']}\n\n")
|
|
|
|
f.write("Display Information:\n")
|
|
f.write(f"{info['displays']}\n")
|
|
|
|
if __name__ == "__main__":
|
|
save_info()
|
|
print("System information has been collected and saved to:")
|
|
print("- tech_specs.json (machine-readable)")
|
|
print("- tech_specs.txt (human-readable)")
|