Add models.json and main.py

This commit is contained in:
Dhinak G
2020-11-23 22:28:39 -05:00
parent a007964f92
commit 615764df54
2 changed files with 316 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
from __future__ import print_function
import json
import subprocess
import sys
models = json.load(open("models.json"))
current_model = subprocess.Popen("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE)
current_model = [line.strip().split(": ", 1)[1] for line in current_model.stdout.read().split("\n") if line.strip().startswith("Model Identifier")][0]
print(current_model)
if current_model not in models:
print("Your model is not supported by this patcher!")
sys.exit(1)