Skip to content

Commit

Permalink
refactor: handfull of fixmes resolved trivally
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlaltf24 authored and thw26 committed Oct 25, 2024
1 parent 6b57284 commit ceffd30
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ou_dedetai/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions ou_dedetai/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 1 addition & 14 deletions ou_dedetai/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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)
2 changes: 1 addition & 1 deletion ou_dedetai/gui_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 3 additions & 11 deletions ou_dedetai/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 0 additions & 8 deletions ou_dedetai/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ou_dedetai/tui_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions ou_dedetai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.")
Expand Down

0 comments on commit ceffd30

Please sign in to comment.