From 27d3b6d23948c562a657c1242c548fb213acd638 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 2 Oct 2023 17:15:01 +0800 Subject: [PATCH 1/3] Added hardware info for the powkiddy rgb30. --- PortMaster/pugwash | 1 + PortMaster/pylibs/harbourmaster/hardware.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/PortMaster/pugwash b/PortMaster/pugwash index 384e410..0bae0b6 100755 --- a/PortMaster/pugwash +++ b/PortMaster/pugwash @@ -520,6 +520,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): # 'rg503' # 'rg351v' # 'rg353v' + 'rgb30' # 'ogs' # 'ogu' # 'x55' diff --git a/PortMaster/pylibs/harbourmaster/hardware.py b/PortMaster/pylibs/harbourmaster/hardware.py index e017eb9..e926451 100644 --- a/PortMaster/pylibs/harbourmaster/hardware.py +++ b/PortMaster/pylibs/harbourmaster/hardware.py @@ -47,6 +47,7 @@ 'rgb10max': {'resolution': ( 854, 480), 'analogsticks': 2, 'cpu': 'rk3326', 'capabilities': []}, 'rgb10s': {'resolution': ( 480, 320), 'analogsticks': 1, 'cpu': 'rk3326', 'capabilities': []}, 'rgb20s': {'resolution': ( 640, 480), 'analogsticks': 2, 'cpu': 'rk3326', 'capabilities': []}, + 'rgb30': {'resolution': ( 720, 720), 'analogsticks': 2, 'cpu': 'rk3566', 'capabilities': ['power']}, 'rk2023': {'resolution': ( 640, 480), 'analogsticks': 2, 'cpu': 'rk3566', 'capabilities': ['power']}, 'rk2020': {'resolution': ( 480, 320), 'analogsticks': 1, 'cpu': 'rk3326', 'capabilities': []}, @@ -65,6 +66,7 @@ ## From PortMaster.sh from JELOS, all devices except x55 and rg10max3 have opengl ('jelos', 'x55'): {'capabilities': []}, ('jelos', 'rgb10max3'): {'capabilities': []}, + ('jelos', 'rgb30'): {'capabilities': []}, ('jelos', HW_ANY): {'capabilities': ['opengl']}, } @@ -94,12 +96,13 @@ def nice_device_to_device(raw_device): pattern_to_device = ( ('Hardkernel ODROID-GO-Ultra', 'ogu'), - ('ODROID-GO Advance*', 'oga'), - ('ODROID-GO Super*', 'ogs'), + ('ODROID-GO Advance*', 'oga'), + ('ODROID-GO Super*', 'ogs'), ('Powkiddy RGB10 MAX 3', 'rgb10max3'), - ('Powkiddy RK2023', 'rk2023'), - ('Powkiddy x55', 'x55'), + ('Powkiddy RGB30', 'rgb30'), + ('Powkiddy RK2023', 'rk2023'), + ('Powkiddy x55', 'x55'), ('Anbernic RG351MP*', 'rg351mp'), ('Anbernic RG351V*', 'rg351v'), @@ -286,7 +289,8 @@ def device_info(override_device=None, override_resolution=None): if "hires" not in info['capabilities']: info['capabilities'].append("hires") - info['capabilities'].append("wide") + if info['resolution'][0] > info['resolution'][1]: + info['capabilities'].append("wide") logger.debug(f"DEVICE INFO: {info}") __root_info = info From 1a9fad80ddb41dc58814971a63d1ab2a0fafff99 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 2 Oct 2023 20:38:11 +0800 Subject: [PATCH 2/3] pugwash: it is now much less verbose, but with options to turn the debugging noise back on. --- PortMaster/pugwash | 42 +++++++++++++-------- PortMaster/pylibs/harbourmaster/captain.py | 4 +- PortMaster/pylibs/harbourmaster/harbour.py | 10 +++-- PortMaster/pylibs/harbourmaster/platform.py | 6 +-- PortMaster/pylibs/pugscene.py | 6 +-- PortMaster/pylibs/pugtheme.py | 6 +-- PortMaster/pylibs/pySDL2gui.py | 2 +- 7 files changed, 45 insertions(+), 31 deletions(-) diff --git a/PortMaster/pugwash b/PortMaster/pugwash index 0bae0b6..4733375 100755 --- a/PortMaster/pugwash +++ b/PortMaster/pugwash @@ -9,7 +9,9 @@ PORTMASTER_RELEASE_CHANNELS = { 'beta': 'https://github.com/PortsMaster/PortMaster-GUI/releases/latest/download/', 'stable': 'https://github.com/PortsMaster/PortMaster-Releases/releases/latest/download/', } + PORTMASTER_UPDATE_FREQUENCY = (60 * 60 * 1) +__builtins__.PORTMASTER_DEBUG = False ## This adds a lot of extra info import contextlib import ctypes @@ -474,10 +476,10 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): version = sdl2.SDL_version() sdl2.SDL_GetVersion(version) - logger.debug(f"SDL DLL: {sdl2.dll.get_dll_file()}, {nice_version(version)}") - logger.debug(f"TTF DLL: {sdl2.sdlttf.get_dll_file()}, {nice_version(sdl2.sdlttf.TTF_Linked_Version()[0])}") - logger.debug(f"IMG DLL: {sdl2.sdlimage.get_dll_file()}, {nice_version(sdl2.sdlimage.IMG_Linked_Version()[0])}") - logger.debug(f"MIX DLL: {sdl2.sdlmixer.get_dll_file()}, {nice_version(sdl2.sdlmixer.Mix_Linked_Version()[0])}") + logger.info(f"SDL DLL: {sdl2.dll.get_dll_file()}, {nice_version(version)}") + logger.info(f"TTF DLL: {sdl2.sdlttf.get_dll_file()}, {nice_version(sdl2.sdlttf.TTF_Linked_Version()[0])}") + logger.info(f"IMG DLL: {sdl2.sdlimage.get_dll_file()}, {nice_version(sdl2.sdlimage.IMG_Linked_Version()[0])}") + logger.info(f"MIX DLL: {sdl2.sdlmixer.get_dll_file()}, {nice_version(sdl2.sdlmixer.Mix_Linked_Version()[0])}") # Load controller. count = sdl2.SDL_NumJoysticks() @@ -487,8 +489,8 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): if is_game_controller == sdl2.SDL_TRUE: pad = sdl2.SDL_GameControllerOpen(index) if pad is not None: - logger.debug(f"Opened GameController {index}: {sdl2.SDL_GameControllerName(pad)}") - logger.debug(f" {sdl2.SDL_GameControllerMapping(pad)}") + logger.info(f"Opened GameController {index}: {sdl2.SDL_GameControllerName(pad)}") + logger.info(f" {sdl2.SDL_GameControllerMapping(pad)}") # Define window dimensions self.display_width = 640 @@ -535,7 +537,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): if capabilities['device'] == 'default': device = harbourmaster.find_device_by_resolution((self.display_width, self.display_height)) - logger.debug(f"FOUND: {device}") + logger.info(f"FOUND: {device}") if device != 'default': capabilities = harbourmaster.device_info(device) @@ -544,7 +546,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): capabilities['capabilities'].append(CURRENT_LANG) - logger.debug(capabilities) + logger.info(capabilities) # Create the window if harbourmaster.HM_TESTING: @@ -684,7 +686,8 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): sdl2.SDL_Delay(30) if self.timers.elapsed('updates_per_second', 1000, run_first=True): - print(f"UPS: {self.draw_counter} / {self.update_counter}") + if PORTMASTER_DEBUG: + print(f"UPS: {self.draw_counter} / {self.update_counter}") self.update_counter = 0 self.draw_counter = 0 self.updated = True @@ -858,7 +861,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): else: self.set_data("port_info.install_size", "") - print(f"INFO: {port_info}") + # print(f"INFO: {port_info}") def set_theme_info(self, theme_name, theme_info): ## TODO: make this better :D @@ -959,7 +962,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): self.text_data[key] = value self.changed_keys.add(key) - logger.debug(f"{key}: {value}") + # logger.debug(f"{key}: {value}") def format_data(self, input_string, used_keys=None): return self.formatter.format_string(input_string, used_keys) @@ -1384,7 +1387,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): del args[i] else: - logger.debug(f"unknown option {args[i]}") + logger.warning(f"unknown option {args[i]}") del args[i] ## This fixes a bug :D @@ -1507,7 +1510,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): del args[i] continue - logger.debug(f"unknown option {args[i]}") + logger.warning(f"unknown option {args[i]}") del args[i] if len(args) == 0: @@ -1612,7 +1615,7 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback): self.fifo_commands[args[0].lower()](self, fifo_config, args[1:]) else: - logger.debug(f"fifo: unknown command {args[0]}") + logger.warning(f"fifo: unknown command {args[0]}") done_file.write_text("DONE") self.do_loop(no_delay=True) @@ -1650,7 +1653,7 @@ def portmaster_check_update(pm, config, temp_dir): if update_checked is None or harbourmaster.datetime_compare(update_checked) > PORTMASTER_UPDATE_FREQUENCY: update_checked_was_none = update_checked is None latest_version = harbourmaster.fetch_text(PORTMASTER_RELEASE_CHANNELS[release_channel] + 'version').strip() - logger.debug(f"Checking for updates: {latest_version} vs {PORTMASTER_VERSION}") + logger.info(f"Checking for updates: {latest_version} vs {PORTMASTER_VERSION}") cfg_data['update_checked'] = datetime.datetime.now().isoformat() if not cfg_file.parent.is_dir(): @@ -1699,6 +1702,7 @@ def portmaster_check_update(pm, config, temp_dir): @logger.catch def main(argv): global LOG_FILE_HANDLE + global LOG_FILE with make_temp_directory() as temp_dir: argv = argv[:] @@ -1741,6 +1745,14 @@ def main(argv): logger.remove(0) # For the default handler, it's actually '0'. logger.add(sys.stderr, level="DEBUG") + elif not PORTMASTER_DEBUG: + logger.remove(0) # For the default handler, it's actually '0'. + logger.add(sys.stderr, level="SUCCESS") + + ## Once we reach here we can just reduce it to INFO level. + logger.remove(LOG_FILE_HANDLE) + LOG_FILE_HANDLE = logger.add(LOG_FILE, level="INFO", backtrace=True, diagnose=True) + if config['no-log']: logger.remove(LOG_FILE_HANDLE) LOG_FILE_HANDLE = None diff --git a/PortMaster/pylibs/harbourmaster/captain.py b/PortMaster/pylibs/harbourmaster/captain.py index 41c9bd3..113f5d9 100644 --- a/PortMaster/pylibs/harbourmaster/captain.py +++ b/PortMaster/pylibs/harbourmaster/captain.py @@ -103,8 +103,8 @@ def check_port(port_name, zip_file, extra_info=None): port_info['name'] = name_cleaner(port_name) port_info['items'] = items - if port_info_data != port_info: - logger.warning(f"port.json is different from what is expected:\n{json.dumps(port_info, indent=4)}") + # if port_info_data != port_info: + # logger.warning(f"port.json is different from what is expected:\n{json.dumps(port_info, indent=4)}") if extra_info is not None: extra_info['port_info_file'] = port_info_file diff --git a/PortMaster/pylibs/harbourmaster/harbour.py b/PortMaster/pylibs/harbourmaster/harbour.py index 69a8c27..2fb1d78 100644 --- a/PortMaster/pylibs/harbourmaster/harbour.py +++ b/PortMaster/pylibs/harbourmaster/harbour.py @@ -691,7 +691,7 @@ def load_ports(self): with ports_files[port_name].open('wt') as fh: json.dump(port_info, fh, indent=4) else: - logger.debug(f"Unable to dump {str(ports_files[port_name])}: {port_info}") + logger.warning(f"Unable to dump {str(ports_files[port_name])}: {port_info}") def port_info_attrs(self, port_info): runtime_fix = { @@ -963,7 +963,7 @@ def _install_theme(self, download_file): """ Installs a theme file. """ - logger.debug(f"Installing theme: {download_file.name}") + logger.info(f"Installing theme: {download_file.name}") if not self.themes_dir.is_dir(): self.themes_dir.mkdir(0o755) @@ -998,7 +998,7 @@ def _install_portmaster(self, download_file): """ Installs a new version of PortMaster """ - logger.debug("Installing PortMaster.zip") + logger.info("Installing PortMaster.zip") # if HM_TESTING: # logger.error("Unable to install PortMaster.zip in testing environment.") # return 255 @@ -1055,6 +1055,7 @@ def _install_port(self, download_info): port_nice_name = download_info.get('attr', {}).get('title', download_info['name']) port_info = {} + logger.info(f"Installing {port_nice_name}") try: extra_info = {} @@ -1146,7 +1147,7 @@ def _install_port(self, download_info): self.callback.message(_("Installation failed, removing files...")) for undo_file in undo_data[::-1]: - logger.debug(f"Removing {undo_file.relative_to(self.ports_dir)}") + logger.info(f"Removing {undo_file.relative_to(self.ports_dir)}") self.callback.message(f"- {str(undo_file.relative_to(self.ports_dir))}") if undo_file.is_file(): @@ -1209,6 +1210,7 @@ def check_runtime(self, runtime, port_name=None, in_install=False): 'Unverified': _('Unverified'), 'Broken': _('Broken'), } + logger.info(f"Installing {runtime_name}") if self.config['offline']: cprint(f"Unable to download {runtime} when offline") diff --git a/PortMaster/pylibs/harbourmaster/platform.py b/PortMaster/pylibs/harbourmaster/platform.py index 186f861..9524c27 100644 --- a/PortMaster/pylibs/harbourmaster/platform.py +++ b/PortMaster/pylibs/harbourmaster/platform.py @@ -74,7 +74,7 @@ def portmaster_install(self): logger.debug(f"{self.__class__.__name__}: PortMaster Install") def set_gcd_mode(self, mode=None): - logger.debug(f"{self.__class__.__name__}: Set GCD Mode {mode}") + logger.info(f"{self.__class__.__name__}: Set GCD Mode {mode}") def get_gcd_modes(self): return tuple() @@ -95,7 +95,7 @@ def set_gcd_mode(self, gcd_mode=None): 'xbox': self.hm.tools_dir / "PortMaster" / ".Backup" / "donottouch_x.txt", } - logger.debug(f"{self.__class__.__name__}: Set GCD Mode: {gcd_mode}") + logger.info(f"{self.__class__.__name__}: Set GCD Mode: {gcd_mode}") if gcd_mode: if gcd_mode not in mode_files: @@ -167,7 +167,7 @@ def portmaster_install(self): PM_DIR = HM_TOOLS_DIR / "PortMaster" if hash_file(BROKEN_MAPPER) == BROKEN_MAPPER_MD5: - logger.debug("Replacing broken mapper.txt if it is still there.") + logger.info("Replacing broken mapper.txt if it is still there.") FIXED_MAPPER = PM_DIR / ".Backup" / "mapper.txt" shutil.copy(FIXED_MAPPER, BROKEN_MAPPER) diff --git a/PortMaster/pylibs/pugscene.py b/PortMaster/pylibs/pugscene.py index 110fa57..f261bdd 100644 --- a/PortMaster/pylibs/pugscene.py +++ b/PortMaster/pylibs/pugscene.py @@ -501,7 +501,7 @@ def do_update(self, events): self.button_activate() - print(f"Selected {selected_option}") + # print(f"Selected {selected_option}") if selected_option == 'update-ports': self.gui.do_update_ports() @@ -601,7 +601,7 @@ def do_update(self, events): self.gui.do_loop() for runtime_file in runtimes: - logger.debug(f"removing {runtime_file}") + logger.info(f"removing {runtime_file}") self.gui.message(f"- {runtime_file}") runtime_file.unlink() self.gui.do_loop() @@ -898,7 +898,7 @@ def do_update(self, events): self.button_activate() - print(f"Selected {selected_option} -> {selected_parameter}") + # print(f"Selected {selected_option} -> {selected_parameter}") if selected_option == 'back': self.gui.pop_scene() diff --git a/PortMaster/pylibs/pugtheme.py b/PortMaster/pylibs/pugtheme.py index 366b1ca..4704afe 100644 --- a/PortMaster/pylibs/pugtheme.py +++ b/PortMaster/pylibs/pugtheme.py @@ -98,7 +98,7 @@ def theme_apply(gui, section_data, base_data, elements): continue if element_name not in elements: - logger.debug(f"Error: Unknown element {element_name}") + logger.warning(f"Error: Unknown element {element_name}") continue new_data[region_name] = theme_merge(base_data, theme_merge(elements[element_name], region_data)) @@ -120,7 +120,7 @@ def theme_apply(gui, section_data, base_data, elements): def theme_load(gui, theme_file, color_scheme=None): - logger.debug(f"Loading theme {theme_file}") + logger.info(f"Loading theme {theme_file}") with open(theme_file, 'r') as fh: theme_data = json.load(fh) @@ -375,7 +375,7 @@ def _update(self): logger.debug(f"images_md5={images_md5}, self.images_md5={self._images_md5}") images_zip = harbourmaster.download(self.hm.temp_dir / "images.zip", images_url_zip, images_md5, callback=self.hm.callback) if images_zip is None: - logger.debug(f"Unable to download {images_url_zip}") + logger.warning(f"Unable to download {images_url_zip}") return images_to_delete = [ diff --git a/PortMaster/pylibs/pySDL2gui.py b/PortMaster/pylibs/pySDL2gui.py index c8ae875..9f69699 100644 --- a/PortMaster/pylibs/pySDL2gui.py +++ b/PortMaster/pylibs/pySDL2gui.py @@ -139,7 +139,7 @@ def add_path(self, path): else: raise GUIValueError(f"Invalid {path!r}") - print(path) + # print(path) if not path.is_dir(): return From 5b8f430862f091251da78347549bb1c04cfd8a12 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 2 Oct 2023 20:38:37 +0800 Subject: [PATCH 3/3] pugwash: bumped version --- PortMaster/pugwash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PortMaster/pugwash b/PortMaster/pugwash index 4733375..7e401bc 100755 --- a/PortMaster/pugwash +++ b/PortMaster/pugwash @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -- BEGIN PORTMASTER INFO -- -PORTMASTER_VERSION = '8.4.13' +PORTMASTER_VERSION = '8.4.14' PORTMASTER_RELEASE_CHANNEL = 'beta' ## -- END PORTMASTER INFO --