From d36589751ea45a7254391986160449ea0e7c2697 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 4 Sep 2022 16:57:55 -0700 Subject: [PATCH 1/3] Fix mount_volumes() under Linux --- scripts/wk/os/linux.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/wk/os/linux.py b/scripts/wk/os/linux.py index 0a11405f..f4aaa7eb 100644 --- a/scripts/wk/os/linux.py +++ b/scripts/wk/os/linux.py @@ -206,8 +206,8 @@ def mount_volumes(device_path=None, read_write=False, scan_corestorage=False): json_data = get_json_from_command(cmd) # Build list of volumes - for dev in _get_volumes(json_data.get('blockdevices', [{}])[0]): - volumes.append(dev) + for dev in json_data.get('blockdevices', [{}]): + volumes.extend(_get_volumes(dev)) if dev.get('parttype', '') == UUID_CORESTORAGE: containers.append(dev['name']) From 5f69e23887f72b94857e5df7f5218494f7c75e32 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 4 Sep 2022 17:44:58 -0700 Subject: [PATCH 2/3] Address Pylint error W1518 --- scripts/wk/std.py | 77 ++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/scripts/wk/std.py b/scripts/wk/std.py index 793a5319..af4b9682 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -501,42 +501,6 @@ class TryAndPrint(): # Done return result_msg - @cache - def _get_exception(self, name): - """Get exception by name, returns exception object. - - [Doctest] - >>> t = TryAndPrint() - >>> t._get_exception('AttributeError') - - >>> t._get_exception('CalledProcessError') - - >>> t._get_exception('GenericError') - - """ - LOG.debug('Getting exception: %s', name) - obj = getattr(sys.modules[__name__], name, None) - if obj: - return obj - - # Try builtin classes - obj = getattr(sys.modules['builtins'], name, None) - if obj: - return obj - - # Try all modules - for _mod in sys.modules.values(): - obj = getattr(_mod, name, None) - if obj: - break - - # Check if not found - if not obj: - raise AttributeError(f'Failed to find exception: {name}') - - # Done - return obj - def _log_result(self, message, result_msg): """Log result text without color formatting.""" log_text = f'{" "*self.indent}{message:<{self.width}}{result_msg}' @@ -595,8 +559,8 @@ class TryAndPrint(): verbose = verbose if verbose is not None else self.verbose # Build exception tuples - e_exceptions = tuple(self._get_exception(e) for e in self.list_errors) - w_exceptions = tuple(self._get_exception(e) for e in self.list_warnings) + e_exceptions = tuple(get_exception(e) for e in self.list_errors) + w_exceptions = tuple(get_exception(e) for e in self.list_warnings) # Run function and catch exceptions print(f'{" "*self.indent}{message:<{self.width}}', end='', flush=True) @@ -830,6 +794,43 @@ def generate_debug_report(): return '\n'.join(report) +@cache +def get_exception(name): + """Get exception by name, returns exception object. + + [Doctest] + >>> t = TryAndPrint() + >>> t._get_exception('AttributeError') + + >>> t._get_exception('CalledProcessError') + + >>> t._get_exception('GenericError') + + """ + LOG.debug('Getting exception: %s', name) + obj = getattr(sys.modules[__name__], name, None) + if obj: + return obj + + # Try builtin classes + obj = getattr(sys.modules['builtins'], name, None) + if obj: + return obj + + # Try all modules + for _mod in sys.modules.values(): + obj = getattr(_mod, name, None) + if obj: + break + + # Check if not found + if not obj: + raise AttributeError(f'Failed to find exception: {name}') + + # Done + return obj + + def get_log_filepath(): """Get the log filepath from the root logger, returns pathlib.Path obj. From a97a71a24a36c0ca23976a51247c8e3f210d7bb2 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 4 Sep 2022 18:10:54 -0700 Subject: [PATCH 3/3] Fix Windows 11 version reporting --- scripts/wk/cfg/windows_builds.py | 5 +++++ scripts/wk/os/win.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/scripts/wk/cfg/windows_builds.py b/scripts/wk/cfg/windows_builds.py index 580564b4..8e74c055 100644 --- a/scripts/wk/cfg/windows_builds.py +++ b/scripts/wk/cfg/windows_builds.py @@ -33,4 +33,9 @@ WINDOWS_BUILDS = { '10.0.19042': '20H2', '10.0.19043': '21H1', '10.0.19044': '21H2', + '10.0.19045': '22H2', + + # Windows 11 + '10.0.22000': '21H2', + '10.0.22621': '22H2', } diff --git a/scripts/wk/os/win.py b/scripts/wk/os/win.py index 7a9e7400..331d75a4 100644 --- a/scripts/wk/os/win.py +++ b/scripts/wk/os/win.py @@ -253,6 +253,8 @@ def get_os_name(as_list=False, check=True): display_name = ( f'{reg_read_value("HKLM", key, "ProductName")} {ARCH}-bit {details}' ) + if build_version >= 22000: + display_name = display_name.replace('Windows 10', 'Windows 11') # Check for support issues if check: