From ceffd30ffc28d84ddb10d0184acd8547506928ba Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:13:29 -0700 Subject: [PATCH] refactor: handfull of fixmes resolved trivally --- ou_dedetai/cli.py | 2 +- ou_dedetai/config.py | 6 ++---- ou_dedetai/control.py | 15 +-------------- ou_dedetai/gui_app.py | 2 +- ou_dedetai/installer.py | 14 +++----------- ou_dedetai/system.py | 8 -------- ou_dedetai/tui_app.py | 2 +- ou_dedetai/utils.py | 4 ++-- 8 files changed, 11 insertions(+), 42 deletions(-) diff --git a/ou_dedetai/cli.py b/ou_dedetai/cli.py index c792df80..9bd88433 100644 --- a/ou_dedetai/cli.py +++ b/ou_dedetai/cli.py @@ -40,7 +40,7 @@ def install_d3d_compiler(self): wine.install_d3d_compiler() def install_dependencies(self): - utils.check_dependencies(app=self) + utils.install_dependencies(app=self) def install_fonts(self): wine.install_fonts() diff --git a/ou_dedetai/config.py b/ou_dedetai/config.py index 2f012455..cdd82ef5 100644 --- a/ou_dedetai/config.py +++ b/ou_dedetai/config.py @@ -62,11 +62,9 @@ # Set other run-time variables not set in the env. ACTION: str = 'app' APPIMAGE_FILE_PATH: Optional[str] = None -authenticated = False # FIXME: no references -BADPACKAGES: Optional[str] = None # FIXME: no references +BADPACKAGES: Optional[str] = None # This isn't presently used, but could be if needed. DEFAULT_CONFIG_PATH = os.path.expanduser(f"~/.config/FaithLife-Community/{name_binary}.json") # noqa: E501 FLPRODUCTi: Optional[str] = None -GUI = None # FIXME: no references INSTALL_STEP: int = 0 INSTALL_STEPS_COUNT: int = 0 L9PACKAGES = None @@ -93,7 +91,7 @@ LOGOS9_WINE64_BOTTLE_TARGZ_NAME = "wine64_bottle.tar.gz" LOGOS9_WINE64_BOTTLE_TARGZ_URL = f"https://github.com/ferion11/wine64_bottle_dotnet/releases/download/v5.11b/{LOGOS9_WINE64_BOTTLE_TARGZ_NAME}" # noqa: E501 LOGOS10_RELEASES = None # used to save downloaded releases list # FIXME: not set #noqa: E501 -MYDOWNLOADS: Optional[str] = None # FIXME: Should this use the tempfile module? +MYDOWNLOADS: Optional[str] = None # FIXME: Should this use ~/.cache? OS_NAME: Optional[str] = None OS_RELEASE: Optional[str] = None PACKAGE_MANAGER_COMMAND_INSTALL: Optional[list[str]] = None diff --git a/ou_dedetai/control.py b/ou_dedetai/control.py index d9ffa5d5..10e547a4 100644 --- a/ou_dedetai/control.py +++ b/ou_dedetai/control.py @@ -269,7 +269,7 @@ def set_winetricks(): # Check if local winetricks version is up-to-date; if so, offer to # use it or to download; else, download it. local_winetricks_version = subprocess.check_output(["winetricks", "--version"]).split()[0] # noqa: E501 - if str(local_winetricks_version) >= "20220411": #FIXME: consider using config.WINETRICKS_VERSION and != string comparision on versions is dodgy #noqa: E501 + if str(local_winetricks_version) != config.WINETRICKS_VERSION: # noqa: E501 if config.DIALOG == 'tk': #FIXME: CLI client not considered logging.info("Setting winetricks to the local binary…") config.WINETRICKSBIN = local_winetricks_path @@ -289,7 +289,6 @@ def set_winetricks(): config.WINETRICKSBIN = local_winetricks_path return 0 elif winetricks_choice.startswith("2"): - # download_winetricks() system.install_winetricks(config.APPDIR_BINDIR) config.WINETRICKSBIN = os.path.join( config.APPDIR_BINDIR, @@ -302,7 +301,6 @@ def set_winetricks(): sys.exit(0) else: msg.status("The system's winetricks is too old. Downloading an up-to-date winetricks from the Internet…") # noqa: E501 - # download_winetricks() system.install_winetricks(config.APPDIR_BINDIR) config.WINETRICKSBIN = os.path.join( config.APPDIR_BINDIR, @@ -311,7 +309,6 @@ def set_winetricks(): return 0 else: msg.status("Local winetricks not found. Downloading winetricks from the Internet…") # noqa: E501 - # download_winetricks() system.install_winetricks(config.APPDIR_BINDIR) config.WINETRICKSBIN = os.path.join( config.APPDIR_BINDIR, @@ -320,13 +317,3 @@ def set_winetricks(): return 0 return 0 - -def download_winetricks(): #FIXME: unused, logic moved to system.install_winetricks - msg.status("Downloading winetricks…") - appdir_bindir = f"{config.INSTALLDIR}/data/bin" - network.logos_reuse_download( - config.WINETRICKS_URL, - "winetricks", - appdir_bindir - ) - os.chmod(f"{appdir_bindir}/winetricks", 0o755) diff --git a/ou_dedetai/gui_app.py b/ou_dedetai/gui_app.py index 3bed0ea8..f06f9d73 100644 --- a/ou_dedetai/gui_app.py +++ b/ou_dedetai/gui_app.py @@ -731,7 +731,7 @@ def run_restore(self, evt=None): def install_deps(self, evt=None): self.start_indeterminate_progress() - utils.start_thread(utils.check_dependencies) + utils.start_thread(utils.install_dependencies) def open_file_dialog(self, filetype_name, filetype_extension): file_path = fd.askopenfilename( diff --git a/ou_dedetai/installer.py b/ou_dedetai/installer.py index 5598f935..3c33dfb6 100644 --- a/ou_dedetai/installer.py +++ b/ou_dedetai/installer.py @@ -349,7 +349,7 @@ def ensure_sys_deps(app=None): update_install_feedback("Ensuring system dependencies are met…", app=app) if not config.SKIP_DEPENDENCIES: - utils.check_dependencies(app) + utils.install_dependencies(app) if config.DIALOG == "curses": app.installdeps_e.wait() logging.debug("> Done.") @@ -674,16 +674,8 @@ def ensure_launcher_shortcuts(app=None): config.INSTALL_STEPS_COUNT += 1 ensure_launcher_executable(app=app) config.INSTALL_STEP += 1 - runmode = system.get_runmode() - # FIXME: why not do this all the time? - if runmode == 'binary': - update_install_feedback("Creating launcher shortcuts…", app=app) - create_launcher_shortcuts() - else: - update_install_feedback( - "Running from source. Skipping launcher creation.", - app=app - ) + update_install_feedback("Creating launcher shortcuts…", app=app) + create_launcher_shortcuts() if config.DIALOG == 'cli': # Signal CLI.user_input_processor to stop. diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 89b9ae3b..f6f4047c 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -260,13 +260,6 @@ def reboot(): sys.exit(0) -def t(command): # FIXME: unused, have_dep does the same thing - if shutil.which(command) is not None: - return True - else: - return False - - def tl(library): try: __import__(library) @@ -276,7 +269,6 @@ def tl(library): def get_dialog(): - # FIXME: wouldn't the cli still work without a DISPLAY? What about wayland? if not os.environ.get('DISPLAY'): msg.logos_error("The installer does not work unless you are running a display") # noqa: E501 diff --git a/ou_dedetai/tui_app.py b/ou_dedetai/tui_app.py index 78bcfe69..6a118ba4 100644 --- a/ou_dedetai/tui_app.py +++ b/ou_dedetai/tui_app.py @@ -541,7 +541,7 @@ def utilities_menu_select(self, choice): self.reset_screen() msg.status("Checking dependencies…", self) self.update_windows() - utils.check_dependencies(self) + utils.install_dependencies(self) self.go_to_main_menu() elif choice == "Back Up Data": self.reset_screen() diff --git a/ou_dedetai/utils.py b/ou_dedetai/utils.py index 042fe497..97dce407 100644 --- a/ou_dedetai/utils.py +++ b/ou_dedetai/utils.py @@ -225,7 +225,7 @@ def delete_symlink(symlink_path): logging.error(f"Error removing symlink: {e}") -def check_dependencies(app=None): # FIXME: misnomer, isn't this an install_dependencies +def install_dependencies(app=None): if config.TARGETVERSION: targetversion = int(config.TARGETVERSION) else: @@ -442,7 +442,7 @@ def get_winetricks_options(): # Check if local winetricks version is up-to-date. cmd = ["winetricks", "--version"] local_winetricks_version = subprocess.check_output(cmd).split()[0] - if str(local_winetricks_version) >= "20220411": #FIXME: consider using config.WINETRICKS_VERSION and != string comparision on versions is dodgy #noqa: E501 + if str(local_winetricks_version) != config.WINETRICKS_VERSION: #noqa: E501 winetricks_options.insert(0, local_winetricks_path) else: logging.info("Local winetricks is too old.")