Skip to content

Commit

Permalink
add distro package to requirements
Browse files Browse the repository at this point in the history
add distro package to requirements

add distro package to requirements

fix bad var name

log get_os and get_package_manager variables

improve logging for get_os, get_packager_manager, and query_packages

comment out "run logos" question b/c not compatible with looped Control Panel
  • Loading branch information
n8marti committed Jan 9, 2024
1 parent f2fb9bd commit 13c40c4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
22 changes: 11 additions & 11 deletions installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,17 @@ def postInstall(app):
shutil.copy(sys.executable, launcher_exe)
create_shortcuts()

if config.DIALOG == 'tk':
# subprocess.Popen(str(launcher_exe))
pass
elif msg.logos_acknowledge_question(f"An executable has been placed at {launcher_exe}.\nDo you want to run it now?\nNOTE: There may be an error on first execution. You can close the error dialog.", "The Script has finished. Exiting…"):
subprocess.Popen([str(launcher_exe)])
elif runmode == 'script':
if config.DIALOG == 'tk':
# subprocess.Popen(sys.argv[0])
pass
elif msg.logos_acknowledge_question(f"Run {config.FLPRODUCT} now?", "The Script has finished. Exiting…"):
subprocess.Popen(sys.argv[0])
# NOTE: Can't launch installed app from installer if control panel is
# running in a loop b/c of die_if_running function.
# if config.DIALOG == 'tk':
# subprocess.Popen(str(launcher_exe))
# elif msg.logos_acknowledge_question(f"An executable has been placed at {launcher_exe}.\nDo you want to run it now?\nNOTE: There may be an error on first execution. You can close the error dialog.", "The Script has finished. Exiting…"):
# subprocess.Popen([str(launcher_exe)])
# elif runmode == 'script':
# if config.DIALOG == 'tk':
# subprocess.Popen(sys.argv[0])
# elif msg.logos_acknowledge_question(f"Run {config.FLPRODUCT} now?", "The Script has finished. Exiting…"):
# subprocess.Popen(sys.argv[0])
message = "The Script has finished. Exiting…"
msg.cli_msg(message)
logging.info(message)
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
altgraph==0.17.4
certifi==2023.11.17
charset-normalizer==3.3.2
distro==1.9.0
idna==3.6
importlib-metadata==7.0.0
packaging==23.2
psutil==5.9.7
pyinstaller==6.3.0
pyinstaller-hooks-contrib==2023.10
requests==2.31.0
urllib3==2.1.0
zipp==3.17.0
17 changes: 16 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ def get_os():

# Fallback to platform module
config.OS_NAME = distro.id() # FIXME: Not working. Returns "Linux".
logging.info(f"OS name: {config.OS_NAME}")
config.OS_RELEASE = distro.version()
logging.info(f"OS release: {config.OS_RELEASE}")
return config.OS_NAME, config.OS_RELEASE

def get_package_manager():
Expand Down Expand Up @@ -295,6 +297,13 @@ def get_package_manager():
config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages
# Add more conditions for other package managers as needed

# Add logging output.
logging.debug(f"{config.SUPERUSER_COMMAND = }")
logging.debug(f"{config.PACKAGE_MANAGER_COMMAND_INSTALL = }")
logging.debug(f"{config.PACKAGE_MANAGER_COMMAND_QUERY = }")
logging.debug(f"{config.PACKAGES = }")
logging.debug(f"{config.L9PACKAGES = }")

def get_runmode():
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
return 'binary'
Expand All @@ -306,10 +315,16 @@ def query_packages(packages):

for p in packages:
command = f"{config.PACKAGE_MANAGER_COMMAND_QUERY}{p}"
logging.debug(f"pkg query command: \"{command}\"")
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, text=True)
logging.debug(f"pkg query result: {result.returncode}")
if result.returncode != 0:
missing_packages.append(p)
logging.info(f"Missing packages: {' '.join(missing_packages)}")

msg = 'None'
if missing_packages:
msg = f"Missing packages: {' '.join(missing_packages)}"
logging.info(f"Missing packages: {msg}")
return missing_packages

def install_packages(packages):
Expand Down
2 changes: 1 addition & 1 deletion wine.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def switch_logging(action=None, app=None):
def get_wine_branch(binary):
logging.info(f"Determining wine branch of '{binary}'")
binary_obj = Path(binary).expanduser().resolve()
appimage, appimage_type = is_appimage(binary_obj)
appimage, appimage_type = utils.is_appimage(binary_obj)
if appimage:
if appimage_type == 1:
logging.error(f"Can't handle AppImage type {str(appimage_type)} yet.")
Expand Down

0 comments on commit 13c40c4

Please sign in to comment.