From 08342dcb0bcd1e162ba3c888e488bd8b771dbc97 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Sun, 2 Feb 2020 12:01:00 -0800 Subject: [PATCH] sys.platform returns `linux2` under Python2. With this change dumping the DSDT should work with both python2 and python3 --- SSDTTime.py | 4 ++-- Scripts/dsdt.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SSDTTime.py b/SSDTTime.py index fd51ee2..b4514fd 100644 --- a/SSDTTime.py +++ b/SSDTTime.py @@ -682,7 +682,7 @@ def main(self): print("1. FixHPET - Patch out IRQ Conflicts") print("2. FakeEC - OS-aware Fake EC") print("3. PluginType - Sets plugin-type = 1 on CPU0/PR00") - if sys.platform == "linux" or sys.platform == "win32": + if sys.platform.startswith('linux') or sys.platform == "win32": print("4. Dump DSDT - Automatically dump the system DSDT") print("") print("D. Select DSDT or origin folder") @@ -703,7 +703,7 @@ def main(self): elif menu == "3": self.plugin_type() elif menu == "4": - if sys.platform == "linux" or sys.platform == "win32": + if sys.platform.startswith('linux') or sys.platform == "win32": self.dsdt = self.d.dump_dsdt(self.output) else: return diff --git a/Scripts/dsdt.py b/Scripts/dsdt.py index 5776293..cc3aa90 100644 --- a/Scripts/dsdt.py +++ b/Scripts/dsdt.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # 0.0.0 -import os, tempfile, shutil, plistlib, sys, binascii, zipfile +import getpass, os, tempfile, shutil, plistlib, sys, binascii, zipfile sys.path.append(os.path.abspath(os.path.dirname(os.path.realpath(__file__)))) import run, downloader, utils @@ -90,7 +90,7 @@ def check_iasl(self): try: if sys.platform == "darwin": self._download_and_extract(temp,self.iasl_url_macOS) - elif sys.platform == "linux": + elif sys.platform.startswith('linux'): self._download_and_extract(temp,self.iasl_url_linux) elif sys.platform == "win32": self._download_and_extract(temp,self.iasl_url_windows) @@ -134,7 +134,7 @@ def dump_dsdt(self, output): self.u.head("Dumping DSDT") print("") res = self.check_output(output) - if sys.platform == "linux": + if sys.platform.startswith('linux'): print("Checking if DSDT exists") e = "/sys/firmware/acpi/tables/DSDT" dsdt_path = os.path.join(res,"DSDT.aml")