Add basic py3 support

This commit is contained in:
Mykola Grymalyuk
2020-12-02 14:56:12 -07:00
parent 939ee3f188
commit 9ace5c9624
2 changed files with 25 additions and 12 deletions

View File

@@ -12,6 +12,13 @@ import zipfile
from Resources import *
# Allow py2 and 3 support
try:
input = raw_input
except NameError:
pass
# List build versions
patcher_version = "0.0.4"
@@ -53,7 +60,7 @@ while MainMenu:
print(" 5. Exit")
print("")
MainMenu = raw_input('Please select an option: ')
MainMenu = input('Please select an option: ')
if MainMenu=="1":
OpenCoreBuilderMenu=True
@@ -69,7 +76,7 @@ while MainMenu:
print(" 3. Return to main menu")
print("")
OpenCoreBuilderMenu = raw_input('Please select an option: ')
OpenCoreBuilderMenu = input('Please select an option: ')
if OpenCoreBuilderMenu=="1":
AutoBuilderMenu=True
@@ -91,7 +98,7 @@ while MainMenu:
print("Your OpenCore EFI has been built at:")
print(" %s" % Versions.opencore_path_done)
print("")
AutoBuilderMenu = raw_input("Press any key to return to previous menu: ")
AutoBuilderMenu = input("Press any key to return to previous menu: ")
if AutoBuilderMenu=="1":
print("Returning to previous menu...")
AutoBuilderMenu=False
@@ -106,7 +113,7 @@ while MainMenu:
print("")
print(" Supported versions: 0.6.3, 0.6.4")
print("")
OpenCoreOption = raw_input('Please enter the OpenCore you want (Press enter to exit): ')
OpenCoreOption = input('Please enter the OpenCore you want (Press enter to exit): ')
if OpenCoreOption == "":
print("Exiting...")
ChangeOCversion=False
@@ -115,7 +122,7 @@ while MainMenu:
print("")
print(" New SMBIOS: %s" % OpenCoreOption)
print("")
ChangeOCversionYN = raw_input("Is this correcy? (y/n)")
ChangeOCversionYN = input("Is this correcy? (y/n)")
if ChangeOCversionYN in {"y", "Y", "yes", "Yes"}:
ChangeOCversion=False
Versions.opencore_version = OpenCoreOption
@@ -143,7 +150,7 @@ while MainMenu:
print(" 2. Return to main menu")
print("")
OpenCoreInstallerMenu = raw_input('Please select an option: ')
OpenCoreInstallerMenu = input('Please select an option: ')
if OpenCoreInstallerMenu=="1":
os.system('clear')
@@ -156,7 +163,7 @@ while MainMenu:
print("OpenCore folder missing!")
print("Please build OpenCore first")
print("")
OpenCoreInstallerMenu = raw_input("Press any key to exit: ")
OpenCoreInstallerMenu = input("Press any key to exit: ")
if OpenCoreInstallerMenu=="1":
print("Returning to main menu...")
OpenCoreInstallerMenu=False
@@ -181,7 +188,7 @@ while MainMenu:
print("")
print(" system_profiler SPHardwareDataType | grep 'Model Identifier'")
print("")
SMBIOSOption = raw_input('Please enter the SMBIOS of your machine (Press enter to exit): ')
SMBIOSOption = input('Please enter the SMBIOS of your machine (Press enter to exit): ')
if SMBIOSOption == "":
print("Exiting...")
SMBIOSMenu=False
@@ -190,7 +197,7 @@ while MainMenu:
print("")
print(" New SMBIOS: %s" % SMBIOSOption)
print("")
SMBIOSMenuYN = raw_input("Is this correcy? (y/n)")
SMBIOSMenuYN = input("Is this correcy? (y/n)")
if SMBIOSMenuYN in {"y", "Y", "yes", "Yes"}:
SMBIOSMenu=False
BuildOpenCore.current_model = SMBIOSOption
@@ -212,7 +219,7 @@ while MainMenu:
print(" - Khronokernel: Writing and maintaining this Patcher")
print(" - Syncretic: AAAMouSSE and telemetrap")
print("")
CreditMenu = raw_input(" Press any key to exit: ")
CreditMenu = input(" Press any key to exit: ")
print("Returning to main menu...")
CreditMenu=False
MainMenu=True

View File

@@ -15,6 +15,12 @@ import zipfile
from Resources import Versions
from Resources import ModelArray
# Allow py2 and 3 support
try:
input = raw_input
except NameError:
pass
# Find SMBIOS of machine
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]
@@ -306,12 +312,12 @@ def ListDiskutil():
print("Loading diskutil...(This may take some time)")
diskList = subprocess.Popen(["diskutil", "list"], stdout=subprocess.PIPE).communicate()[0]
print(diskList)
ChosenDisk = raw_input('Please select the disk you want to install OpenCore to(ie. disk1): ')
ChosenDisk = input('Please select the disk you want to install OpenCore to(ie. disk1): ')
ChosenDisk = ChosenDisk + "s1"
print("Trying to mount %s" % ChosenDisk)
diskMount = subprocess.Popen(["sudo", "diskutil", "mount", ChosenDisk], stdout=subprocess.PIPE).communicate()[0]
print(diskMount)
DiskMenu = raw_input("Press any key to continue: ")
DiskMenu = input("Press any key to continue: ")
def MoveOpenCore():
print("")