This commit is contained in:
Vinícius Moreira
2021-12-24 08:57:42 -03:00
committed by GitHub
7 changed files with 36 additions and 23 deletions

View File

@@ -35,10 +35,10 @@ AppDir:
- python3-pyqt5 - python3-pyqt5
- python3-lxml - python3-lxml
- python3-bs4 - python3-bs4
- python3-pkg-resources
- sqlite3 - sqlite3
- axel - axel
- aria2 - aria2
- wget
- libfreetype6 - libfreetype6
- libfontconfig1 - libfontconfig1
exclude: [] exclude: []

View File

@@ -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/). 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 ## [0.9.24] 2021-12-17
### Features ### Features
- Web - Web

View File

@@ -1,4 +1,4 @@
__version__ = '0.9.24' __version__ = '0.9.25'
__app_name__ = 'bauh' __app_name__ = 'bauh'
import os import os

View File

@@ -60,11 +60,11 @@ class HttpClient:
self.logger.warning(f"The URL '{url}' has an invalid schema") self.logger.warning(f"The URL '{url}' has an invalid schema")
raise e 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() traceback.print_exc()
continue 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): 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) res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects, session=session)
@@ -86,7 +86,7 @@ class HttpClient:
else: else:
res = requests.get(**params) res = requests.get(**params)
except requests.exceptions.ConnectionError: 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 return
if res.status_code == 200: if res.status_code == 200:

View File

@@ -217,12 +217,6 @@ class ArchManager(SoftwareManager):
self.disk_cache_updater = disk_cache_updater self.disk_cache_updater = disk_cache_updater
self.pkgbuilder_user: Optional[str] = f'{__app_name__}-aur' if context.root_user else None 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: def refresh_mirrors(self, root_password: str, watcher: ProcessWatcher) -> bool:
handler = ProcessHandler(watcher) handler = ProcessHandler(watcher)
@@ -377,8 +371,7 @@ class ArchManager(SoftwareManager):
search_threads.append(t) search_threads.append(t)
if aur_supported: if aur_supported:
aur_query = self.get_aur_semantic_search_map().get(words, words) taur = Thread(target=self._fill_aur_search_results, args=(words, search_output), daemon=True)
taur = Thread(target=self._fill_aur_search_results, args=(aur_query, search_output), daemon=True)
taur.start() taur.start()
search_threads.append(taur) search_threads.append(taur)

View File

@@ -16,7 +16,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
from bauh import __app_name__, ROOT_DIR from bauh import __app_name__, ROOT_DIR
from bauh.api.abstract.model import PackageUpdate from bauh.api.abstract.model import PackageUpdate
from bauh.api.http import HttpClient 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.context import generate_i18n
from bauh.view.core.tray_client import TRAY_CHECK_FILE from bauh.view.core.tray_client import TRAY_CHECK_FILE
from bauh.view.core.update import check_for_update from bauh.view.core.update import check_for_update
@@ -29,6 +29,9 @@ CLI_NAME = f'{__app_name__}-cli'
def get_cli_path() -> str: def get_cli_path() -> str:
if os.getenv('APPIMAGE'):
return CLI_NAME
venv = os.getenv('VIRTUAL_ENV') venv = os.getenv('VIRTUAL_ENV')
if venv: if venv:
@@ -48,9 +51,12 @@ def get_cli_path() -> str:
def list_updates(logger: logging.Logger) -> List[PackageUpdate]: def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
cli_path = get_cli_path() cli_path = get_cli_path()
if 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)] return [PackageUpdate(pkg_id=o['id'], name=o['name'], version=o['version'], pkg_type=o['type']) for o in json.loads(output)]
else: else:
logger.info("No updates found") logger.info("No updates found")

View File

@@ -11,7 +11,7 @@ from colorama import Fore
from bauh import __app_name__ from bauh import __app_name__
from bauh.api.abstract.controller import SoftwareManager 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.commons.system import run_cmd
from bauh.view.util import resource from bauh.view.util import resource
@@ -36,11 +36,10 @@ def get_default_icon(system: bool = True) -> Tuple[str, QIcon]:
def restart_app(): def restart_app():
""" appimage_path = os.getenv('APPIMAGE')
:param show_panel: if the panel should be displayed after the app restart
:return: restart_cmd = [appimage_path] if appimage_path else [sys.executable, *sys.argv]
"""
restart_cmd = [sys.executable, *sys.argv]
subprocess.Popen(restart_cmd) subprocess.Popen(restart_cmd)
QCoreApplication.exit() QCoreApplication.exit()
@@ -61,7 +60,7 @@ def clean_app_files(managers: List[SoftwareManager], logs: bool = True):
if logs: if logs:
print('[bauh] Cleaning configuration and cache files') 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: if logs:
print('[bauh] Deleting directory {}'.format(path)) print('[bauh] Deleting directory {}'.format(path))