diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index 247a735e..53463576 100755 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -35,10 +35,10 @@ AppDir: - python3-pyqt5 - python3-lxml - python3-bs4 - - python3-pkg-resources - sqlite3 - axel - aria2 + - wget - libfreetype6 - libfontconfig1 exclude: [] diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cefc2b5..617af3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.9.25] 2021-12-24 +### Improvements +- General + - `--reset`: cleaning the temporary files as well (`/tmp/bauh@$USER`) + - code refactoring + +- Arch + - AUR: letting the API perform the semantic search + +### Fixes +- AppImage package + - not able to reinitialize (e.g: when settings are changed) + - tray mode: not able to call `bauh-cli` to notify updates + + ## [0.9.24] 2021-12-17 ### Features - Web diff --git a/bauh/__init__.py b/bauh/__init__.py index 645edec0..1030f2e3 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.9.24' +__version__ = '0.9.25' __app_name__ = 'bauh' import os diff --git a/bauh/api/http.py b/bauh/api/http.py index e4836ec5..89f1265b 100644 --- a/bauh/api/http.py +++ b/bauh/api/http.py @@ -60,11 +60,11 @@ class HttpClient: self.logger.warning(f"The URL '{url}' has an invalid schema") raise e - self.logger.error("Could not retrieve data from '{}'".format(url)) + self.logger.error(f"Could not retrieve data from '{url}'") traceback.print_exc() continue - self.logger.warning("Could not retrieve data from '{}'".format(url)) + self.logger.warning(f"Could not retrieve data from '{url}'") def get_json(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, session: bool = True): res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects, session=session) @@ -86,7 +86,7 @@ class HttpClient: else: res = requests.get(**params) except requests.exceptions.ConnectionError: - self.logger.info("Internet seems to be off. Could not reach '{}'".format(url)) + self.logger.info(f"Internet seems to be off. Could not reach '{url}'") return if res.status_code == 200: diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 635ce949..5c67fdd9 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -217,12 +217,6 @@ class ArchManager(SoftwareManager): self.disk_cache_updater = disk_cache_updater self.pkgbuilder_user: Optional[str] = f'{__app_name__}-aur' if context.root_user else None - @staticmethod - def get_aur_semantic_search_map() -> Dict[str, str]: - return {'google chrome': 'google-chrome', - 'chrome google': 'google-chrome', - 'googlechrome': 'google-chrome'} - def refresh_mirrors(self, root_password: str, watcher: ProcessWatcher) -> bool: handler = ProcessHandler(watcher) @@ -377,8 +371,7 @@ class ArchManager(SoftwareManager): search_threads.append(t) if aur_supported: - aur_query = self.get_aur_semantic_search_map().get(words, words) - taur = Thread(target=self._fill_aur_search_results, args=(aur_query, search_output), daemon=True) + taur = Thread(target=self._fill_aur_search_results, args=(words, search_output), daemon=True) taur.start() search_threads.append(taur) diff --git a/bauh/view/qt/systray.py b/bauh/view/qt/systray.py index 1f72020e..a3161d80 100755 --- a/bauh/view/qt/systray.py +++ b/bauh/view/qt/systray.py @@ -16,7 +16,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu from bauh import __app_name__, ROOT_DIR from bauh.api.abstract.model import PackageUpdate from bauh.api.http import HttpClient -from bauh.commons.system import run_cmd +from bauh.commons import system from bauh.context import generate_i18n from bauh.view.core.tray_client import TRAY_CHECK_FILE from bauh.view.core.update import check_for_update @@ -29,6 +29,9 @@ CLI_NAME = f'{__app_name__}-cli' def get_cli_path() -> str: + if os.getenv('APPIMAGE'): + return CLI_NAME + venv = os.getenv('VIRTUAL_ENV') if venv: @@ -48,9 +51,12 @@ def get_cli_path() -> str: def list_updates(logger: logging.Logger) -> List[PackageUpdate]: cli_path = get_cli_path() if cli_path: - output = run_cmd(f'{cli_path} updates -f json') + exitcode, output = system.execute(f'{cli_path} updates -f json', custom_env=dict(os.environ)) - if output: + if exitcode != 0: + output_log = output.replace('\n', ' ') if output else ' ' + logger.warning(f'Command "{CLI_NAME} updates" returned an unexpected exitcode ({exitcode}). Output: {output_log}') + elif output: return [PackageUpdate(pkg_id=o['id'], name=o['name'], version=o['version'], pkg_type=o['type']) for o in json.loads(output)] else: logger.info("No updates found") diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index 4d9078df..a1a8e3b1 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -11,7 +11,7 @@ from colorama import Fore from bauh import __app_name__ from bauh.api.abstract.controller import SoftwareManager -from bauh.api.paths import CONFIG_DIR, CACHE_DIR +from bauh.api.paths import CONFIG_DIR, CACHE_DIR, TEMP_DIR from bauh.commons.system import run_cmd from bauh.view.util import resource @@ -36,11 +36,10 @@ def get_default_icon(system: bool = True) -> Tuple[str, QIcon]: def restart_app(): - """ - :param show_panel: if the panel should be displayed after the app restart - :return: - """ - restart_cmd = [sys.executable, *sys.argv] + appimage_path = os.getenv('APPIMAGE') + + restart_cmd = [appimage_path] if appimage_path else [sys.executable, *sys.argv] + subprocess.Popen(restart_cmd) QCoreApplication.exit() @@ -61,7 +60,7 @@ def clean_app_files(managers: List[SoftwareManager], logs: bool = True): if logs: print('[bauh] Cleaning configuration and cache files') - for path in (CACHE_DIR, CONFIG_DIR): + for path in (CACHE_DIR, CONFIG_DIR, TEMP_DIR): if logs: print('[bauh] Deleting directory {}'.format(path))