Skip to content

Commit

Permalink
0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifmor authored Nov 29, 2019
2 parents 1ff34a9 + a6de4ca commit 1d6107b
Show file tree
Hide file tree
Showing 57 changed files with 624 additions and 244 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ 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.7.3] 2019-11-29
### Improvements
- Not breaking the application when a i18n (translation) key was not found
- Adding all english (**en**) i18n keys to help people with the application translation
- AppImage
- AppImage updater daemon replaced by a default Python thread to reduce memory usage
- AUR
- The optimized **makepkg.conf** file is now generated at **~/.config/bauh/arch/makepkg.conf** and passed as a parameter during package builds to not provoke the auto-merge of **/etc/makepkg.conf** and the old generated **~/.makepkg.conf**.
(P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools). Behavior discussed in [#30](https://github.com/vinifmor/bauh/issues/30).
- Removing an unnecessary **prepare** step executed during dependency checking reducing the packages installation time. Also this step was preventing some packages to install due to its repeated execution ( e.g: xdman )
- Now AUR packages are enabled by default, but a warning is displayed in the installation dialog
- New package suggestions
- Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23)
- i18n:
- Catalan contributions by [fitojb](https://github.com/fitojb)
- German contributions by [JonasLoos](https://github.com/JonasLoos)
- Italian contributions by [albanobattistella](https://github.com/albanobattistella)
- minor UI improvements

### Features
- New command line argument to clean the configuration and cache files: `--clean`

### Fixes
- Flatpak
- Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed )

### UI
- AUR
- Textual dependencies replaced by read-only checkboxes on Required Dependencies confirmation dialog
- Optional Dependencies installation dialog now has a type icon beside the dependency name

## [0.7.2] 2019-11-01
### Improvements
- Snap
Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ The way to go here is to ask yourself if the improvement would be useful for mor
* Explain why you think these changes could be useful
* If it fixes a bug, be sure to link to the issue itself.
* Follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) code style to keep the code consistent.

# Adding a new translation
* To add a new translation, you will have to create a file in each directory listed below named as the first two letters of the language in the ISO format (e.g: for 'english' would be 'en'):
- **bauh/view/resources/locale**
- **bauh/gems/appimage/resources/locale**
- **bauh/gems/arch/resources/locale**
- **bauh/gems/flatpak/resources/locale**
- **bauh/gems/snap/resources/locale**
77 changes: 51 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ It has a **tray mode** (see **Settings** below) that attaches the application ic

This project has an official Twitter account ( **@bauh4linux** ) so people can stay on top of its news.

To contribute with this project, have a look at [CONTRIBUTING.md](https://github.com/vinifmor/bauh/blob/master/CONTRIBUTING.md)


![management panel](https://raw.githubusercontent.com/vinifmor/bauh/master/pictures/panel.png)


### Developed with:
### Developed with
- Python3 and Qt5.

### Requirements
Expand Down Expand Up @@ -50,58 +52,81 @@ As [**bauh**](https://aur.archlinux.org/packages/bauh) package. There is also a
It may require **sudo**, but prefer the **Manual installation** described below to not mess up with your system libraries.


### Manual installation:
If you prefer a manual and isolated installation, type the following commands within the cloned project folder:
### Manual installation
- If you prefer a manual and isolated installation, open your favorite terminal application and type the following commands:

```
python3 -m venv bauh_env ( creates a virtualenv in a folder called **bauh_env** )
bauh_env/bin/pip install bauh ( installs bauh in the isolated environment )
bauh_env/bin/bauh ( launches bauh )
# P.S: if you want to launch it attached to your system tray, replace the last command by: bauh_env/bin/bauh --tray=1
```

- To update your isolated bauh to the latest version:
```
python3 -m venv env ( creates a virtualenv in a folder called **env** )
env/bin/pip install . ( installs the application code inside the **env** )
env/bin/bauh ( launches the application )
bauh_env/bin/pip install bauh --upgrade
```

If you do not want to clone / download this repository, go to your **Home** folder and execute the commands above, but replace the second by ```env/bin/pip install bauh```.
- To uninstall it just remove the **bauh_env** folder

- To create a shortcut ( desktop entry ) for it in your system menu ( assuming you created the isolated environment in your home folder using Python 3.7 ):
- Create a file called **bauh.desktop** in **~/.local/share/applications** with the following content
```
[Desktop Entry]
Type=Application
Name=bauh
Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap )
Exec=/home/$USER/bauh_env/bin/bauh
Icon=/home/$USER/bauh_env/lib/python3.7/site-packages/bauh/view/resources/img/logo.svg
```

- If you want a shortcut to the tray, put the **--tray=1** parameter in the end of the **Exec** line of the example above ( e.g: **Exec=/home/$USER/bauh_env/bin/bauh --tray=1** )
- P.S: If the shortcut is not working, try to replace the **$USER** var by your user name.

### Autostart
In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**).

### Uninstallation
Before uninstalling bauh via your package manager, consider executing `bauh --clean` to remove configuration and cache files stored in your **HOME** folder.

### Gems ( package technology support )
#### Flatpak ( flatpak gem )
#### Flatpak ( flatpak )
- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history

#### Snap ( snap gem )
#### Snap ( snap )
- The user is able to search, install, uninstall, refresh, launch and downgrade applications

#### AUR ( arch gem )
- It is **not enabled by default**
#### AppImage ( appimage )
- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history
- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** )
- Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section.
- Installed applications are store at **~/.local/share/bauh/appimage/installed**
- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications**
- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db**
- Databases updater daemon running every 20 minutes ( the interval in SECONDS can be changed with the environment variable **BAUH_APPIMAGE_DB_UPDATER_TIME** ). It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**.
- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt

Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application.

#### AUR ( arch )
- The user is able to search, install, uninstall, downgrade, launch and retrieve the packages history
- It handles conflicts, and missing / optional packages installations ( including from your distro mirrors )
- If [**aria2**](https://github.com/aria2/aria2) is installed on your system and multi-threaded downloads are enabled ( see **BAUH_DOWNLOAD_MULTITHREAD** ), the source packages
will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings ).
- Automatically makes simple package compilation improvements:

a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf** and **~/.makepkg.conf** does not exist,
then a copy of **/etc/makepkg.conf** will be generated at **~/.makepkg.conf** defining MAKEFLAGS to work with
a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf**,
then a copy of **/etc/makepkg.conf** will be generated at **~/.config/bauh/arch/makepkg.conf** defining MAKEFLAGS to work with
the number of your machine processors (**-j${nproc}**).

b) same as previous, but related to **COMPRESSXZ** definition ( if '--threads=0' is not defined )

Obs: this feature can be disabled through the environment variable **BAUH_ARCH_OPTIMIZE=0**
( For more information about these optimizations, check: https://wiki.archlinux.org/index.php/Makepkg )
( For more information about these optimizations, have a look at [Makepkg](https://wiki.archlinux.org/index.php/Makepkg)
- Arch package memory-indexer running every 20 minutes. This memory index is used when AUR Api cannot handle the amount of results found for a given search. It can be disabled via the environment variable **BAUH_ARCH_AUR_INDEX_UPDATER=0**.
- If some of your installed packages are not categorized, send an e-mail to **[email protected]** informing their names and categories in the following format: ```name=category1[,category2,category3,...]```

#### AppImage ( appimage gem )
- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history
- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** )
- Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section.
- Installed applications are store at **~/.local/share/bauh/appimage/installed**
- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications**
- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db**
- Databases updater daemon running every 20 minutes. It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**.
- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt

Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application.


### General settings
You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information).
Expand Down
16 changes: 12 additions & 4 deletions aur/bauh.desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[Desktop Entry]
Type=Application
Name=bauh
Name=Applications manager ( bauh )
Name[pt]=Gerenciador de aplicativos ( bauh )
Name[es]=Administrador de aplicaciones ( bauh )
Name[ca]=Gestor d aplicacions ( bauh )
Name[it]=Gestore delle applicazioni ( bauh )
Name[de]=Anwendungsmanager ( bauh )
Categories=System;
Comment=Manage your Flatpak / Snap / AppImage / AUR applications
Comment[pt]=Gerencie seus aplicativos Flatpak / Snap / AppImage / AUR
Comment[es]=Administre sus aplicaciones Flatpak / Snap / AppImage / AUR
Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap )
Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap )
Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap )
Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap )
Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap )
Comment[ca]=Instal·lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap )
Exec=/usr/bin/bauh
Icon=bauh
18 changes: 12 additions & 6 deletions aur/bauh_tray.desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[Desktop Entry]
Type=Application
Name=bauh ( tray )
Name[pt]=bauh ( bandeja )
Name[es]=bauh ( bandeja )
Name=Applications manager ( bauh - tray )
Name[pt]=Gerenciador de aplicativos ( bauh - bandeja )
Name[es]=Administrador de aplicaciones ( bauh - bandeja )
Name[ca]=Gestor d aplicacions ( bauh - safata )
Name[it]=Gestore delle applicazioni ( bauh - vassoio )
Name[de]=Anwendungsmanager ( bauh - tablett )
Categories=System;
Comment=Manage your Flatpak / Snap / AppImage / AUR applications
Comment[pt]=Gerencie seus aplicativos Flatpak / Snap / AppImage / AUR
Comment[es]=Administre sus aplicaciones Flatpak / Snap / AppImage / AUR
Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap )
Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap )
Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap )
Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap )
Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap )
Comment[ca]=Instal·lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap )
Exec=/usr/bin/bauh --tray=1
Icon=bauh
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.7.2'
__version__ = '0.7.3'
__app_name__ = 'bauh'

import os
Expand Down
6 changes: 3 additions & 3 deletions bauh/api/abstract/context.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import logging
import platform
import sys

from bauh.api.abstract.cache import MemoryCacheFactory
from bauh.api.abstract.disk import DiskCacheLoaderFactory
from bauh.api.abstract.download import FileDownloader
from bauh.api.http import HttpClient
from bauh.view.util.translation import I18n


class ApplicationContext:

def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: dict,
def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: I18n,
cache_factory: MemoryCacheFactory, disk_loader_factory: DiskCacheLoaderFactory,
logger: logging.Logger, file_downloader: FileDownloader, distro: str):
"""
:param disk_cache: if package data should be cached to disk
:param download_icons: if packages icons should be downloaded
:param http_client: a shared instance of http client
:param app_root_dir: GUI root dir
:param i18n: the i18n dictionary keys
:param i18n: the translation keys
:param cache_factory:
:param disk_loader_factory:
:param logger: a logger instance
Expand Down
3 changes: 2 additions & 1 deletion bauh/api/abstract/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class InputOption:
Represents a select component option.
"""

def __init__(self, label: str, value: object, tooltip: str = None, icon_path: str = None):
def __init__(self, label: str, value: object, tooltip: str = None, icon_path: str = None, read_only: bool = False):
"""
:param label: the string that will be shown to the user
:param value: the option value (not shown)
Expand All @@ -45,6 +45,7 @@ def __init__(self, label: str, value: object, tooltip: str = None, icon_path: st
self.value = value
self.tooltip = tooltip
self.icon_path = icon_path
self.read_only = read_only

def __hash__(self):
return hash(self.label) + hash(self.value)
Expand Down
1 change: 1 addition & 0 deletions bauh/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

HOME_PATH = Path.home()
CACHE_PATH = '{}/.cache/bauh'.format(HOME_PATH)
CONFIG_PATH = '{}/.config/bauh'.format(HOME_PATH)
16 changes: 13 additions & 3 deletions bauh/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@
from bauh.view.core.downloader import AdaptableFileDownloader
from bauh.view.qt.systray import TrayIcon
from bauh.view.qt.window import ManageWindow
from bauh.view.util import util, logs, resource
from bauh.view.util import util, logs, resource, translation
from bauh.view.util.cache import DefaultMemoryCacheFactory, CacheCleaner
from bauh.view.util.disk import DefaultDiskCacheLoaderFactory
from bauh.view.util.translation import I18n

DEFAULT_I18N_KEY = 'en'


def main():
if not os.getenv('PYTHONUNBUFFERED'):
os.environ['PYTHONUNBUFFERED'] = '1'

args = app_args.read()

logger = logs.new_logger(__app_name__, bool(args.logs))
app_args.validate(args, logger)

i18n_key, i18n = util.get_locale_keys(args.locale)
if args.clean:
util.clean_app_files()
exit(0)

i18n_key, current_i18n = translation.get_locale_keys(args.locale)
default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {}
i18n = I18n(current_i18n, default_i18n)

cache_cleaner = CacheCleaner()
cache_factory = DefaultMemoryCacheFactory(expiration_time=args.cache_exp, cleaner=cache_cleaner)
Expand Down Expand Up @@ -57,7 +67,7 @@ def main():
if app.style().objectName().lower() not in {'fusion', 'breeze'}:
app.setStyle('Fusion')

managers = gems.load_managers(context=context, locale=i18n_key, config=user_config)
managers = gems.load_managers(context=context, locale=i18n_key, config=user_config, default_locale=DEFAULT_I18N_KEY)

manager = GenericSoftwareManager(managers, context=context, app_args=args)
manager.prepare()
Expand Down
1 change: 1 addition & 0 deletions bauh/app_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def read() -> Namespace:
parser.add_argument('--logs', action="store", default=int(os.getenv('BAUH_LOGS', 0)), choices=[0, 1], type=int, help='If the application logs should be displayed. Default: %(default)s')
parser.add_argument('--show-panel', action="store_true", help='Shows the management panel after the app icon is attached to the tray.')
parser.add_argument('-dmt', '--download-mthread', action="store", default=os.getenv('BAUH_DOWNLOAD_MULTITHREAD', 1), choices=[0, 1], type=int, help='If installation files should be downloaded using multi-threads (only possible if aria2c is installed). Not all gems support this feature. Check README.md. Default: %(default)s')
parser.add_argument('--clean', action="store_true", help='Removes all configuration and cache files')
return parser.parse_args()


Expand Down
13 changes: 6 additions & 7 deletions bauh/gems/appimage/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import traceback
from datetime import datetime
from pathlib import Path
from threading import Lock
from typing import Set, Type, List

from bauh.api.abstract.context import ApplicationContext
Expand All @@ -18,7 +19,7 @@
from bauh.api.constants import HOME_PATH
from bauh.commons.html import bold
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions, db
from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions
from bauh.gems.appimage.model import AppImage
from bauh.gems.appimage.worker import DatabaseUpdater

Expand All @@ -43,18 +44,19 @@ def __init__(self, context: ApplicationContext):
self.http_client = context.http_client
self.logger = context.logger
self.file_downloader = context.file_downloader
self.dbs_updater = DatabaseUpdater(http_client=context.http_client, logger=context.logger)
self.db_locks = {DB_APPS_PATH: Lock(), DB_RELEASES_PATH: Lock()}
self.dbs_updater = DatabaseUpdater(http_client=context.http_client, logger=context.logger, db_locks=self.db_locks)

def _get_db_connection(self, db_path: str) -> sqlite3.Connection:
if os.path.exists(db_path):
db.acquire_lock(db_path)
self.db_locks[db_path].acquire()
return sqlite3.connect(db_path)
else:
self.logger.warning("Could not get a database connection. File '{}' not found".format(db_path))

def _close_connection(self, db_path: str, con: sqlite3.Connection):
con.close()
db.release_lock(db_path)
self.db_locks[db_path].release()

def _gen_app_key(self, app: AppImage):
return '{}{}'.format(app.name.lower(), app.github.lower() if app.github else '')
Expand Down Expand Up @@ -380,9 +382,6 @@ def requires_root(self, action: str, pkg: AppImage):
return False

def prepare(self):
for path in (DB_APPS_PATH, DB_RELEASES_PATH):
db.release_lock(path)

self.dbs_updater.start()

def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
Expand Down
Loading

0 comments on commit 1d6107b

Please sign in to comment.