From 80756c23aff62fd98469fe8626289feb596e708b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 22 Dec 2021 17:43:54 -0300 Subject: [PATCH 1/9] bumping version to 0.9.25 --- bauh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 68ce25b287c73d0436211990ae4f50151e81793b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 22 Dec 2021 17:49:26 -0300 Subject: [PATCH 2/9] [AppImage package] fix: not able to reinitialize --- CHANGELOG.md | 5 +++++ bauh/view/util/util.py | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cefc2b5..ea0c9f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ 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] +### Fixes +- AppImage package + - not able to reinitialize (e.g: when settings are changed) + ## [0.9.24] 2021-12-17 ### Features - Web diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index 4d9078df..eaea3d7c 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -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() From b24b1eb5cf6be00729cb1cfefc86c049fcf33c36 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 23 Dec 2021 13:58:12 -0300 Subject: [PATCH 3/9] [view.qt.systray] fix: not able to call to notify updates (AppImage package) --- CHANGELOG.md | 3 ++- bauh/view/qt/systray.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea0c9f4a..4ee019c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.25] ### Fixes - AppImage package - - not able to reinitialize (e.g: when settings are changed) + - 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 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 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 @@ 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") From 76ffcd07112d513c9c28e04bddca44a7acab54b5 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 23 Dec 2021 18:42:23 -0300 Subject: [PATCH 4/9] [AppImageBuilder.yml] installing 'wget' --- AppImageBuilder.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index 247a735e..e541df8f 100755 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -39,6 +39,7 @@ AppDir: - sqlite3 - axel - aria2 + - wget - libfreetype6 - libfontconfig1 exclude: [] From 605ad15a96a6d1900c4a24a4f3d05278bb06368a Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 23 Dec 2021 18:43:26 -0300 Subject: [PATCH 5/9] [AppImageBuilder.yml] removing unneeded dependency 'python3-pkg-resources' --- AppImageBuilder.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index e541df8f..53463576 100755 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -35,7 +35,6 @@ AppDir: - python3-pyqt5 - python3-lxml - python3-bs4 - - python3-pkg-resources - sqlite3 - axel - aria2 From ba2e3c4f35ad8c299c6c9f832df5de0157eedaa0 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 24 Dec 2021 08:20:49 -0300 Subject: [PATCH 6/9] improvement: --reset now cleans the temporary files as well --- CHANGELOG.md | 3 +++ bauh/view/util/util.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee019c7..594f8e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ 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] +### Improvements +- `--reset`: cleaning the temporary files as well (`/tmp/bauh@$USER`) + ### Fixes - AppImage package - not able to reinitialize (e.g: when settings are changed) diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index eaea3d7c..a1a8e3b1 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -11,7 +11,7 @@ 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 @@ -60,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)) From ea42871eda2c333984cc8d7f1c232254a292a062 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 24 Dec 2021 08:28:00 -0300 Subject: [PATCH 7/9] [arch] improvement: letting the AUR's API perform the semantic search --- CHANGELOG.md | 6 +++++- bauh/gems/arch/controller.py | 9 +-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 594f8e1a..3c9ff947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.25] ### Improvements -- `--reset`: cleaning the temporary files as well (`/tmp/bauh@$USER`) +- General + - `--reset`: cleaning the temporary files as well (`/tmp/bauh@$USER`) + +- Arch + - AUR: letting the API perform the semantic search ### Fixes - AppImage package 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 @@ def __init__(self, context: ApplicationContext, disk_cache_updater: Optional[Arc 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 @@ def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_u 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) From 05694342cc1c6abf7064d7b2dd6e6730f359c39b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 24 Dec 2021 08:31:01 -0300 Subject: [PATCH 8/9] [api.http] refactoring: String formatting method --- bauh/api/http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 @@ def get(self, url: str, params: dict = None, headers: dict = None, allow_redirec 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 @@ def get_content_length_in_bytes(self, url: str, session: bool = True) -> Optiona 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: From bc7313123a32eecade0337988419bec61991da3b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 24 Dec 2021 08:33:56 -0300 Subject: [PATCH 9/9] [CHANGELOG.md] Updating 0.9.25 changes --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c9ff947..617af3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,11 @@ 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] +## [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 @@ -17,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - 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