Skip to content

Commit

Permalink
0.9.25
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifmor authored Dec 24, 2021
2 parents 6f8ed6f + bc73131 commit 8c85c31
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ AppDir:
- python3-pyqt5
- python3-lxml
- python3-bs4
- python3-pkg-resources
- sqlite3
- axel
- aria2
- wget
- libfreetype6
- libfontconfig1
exclude: []
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bauh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.9.24'
__version__ = '0.9.25'
__app_name__ = 'bauh'

import os
Expand Down
6 changes: 3 additions & 3 deletions bauh/api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
9 changes: 1 addition & 8 deletions bauh/gems/arch/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
12 changes: 9 additions & 3 deletions bauh/view/qt/systray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +29,9 @@


def get_cli_path() -> str:
if os.getenv('APPIMAGE'):
return CLI_NAME

venv = os.getenv('VIRTUAL_ENV')

if venv:
Expand All @@ -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")
Expand Down
13 changes: 6 additions & 7 deletions bauh/view/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()

Expand All @@ -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))

Expand Down

0 comments on commit 8c85c31

Please sign in to comment.