This commit is contained in:
Vinícius Moreira
2022-02-11 16:02:36 -03:00
committed by GitHub
11 changed files with 248 additions and 143 deletions

7
.gitignore vendored
View File

@@ -8,3 +8,10 @@ dist
*.egg-info *.egg-info
build build
*.db *.db
linux_dist/appimage/AppDir
linux_dist/appimage/appimage-builder-cache
linux_dist/appimage/*.zsync
linux_dist/appimage/*.AppImage
linux_dist/appimage/*.gz
linux_dist/appimage/bauh-*

View File

@@ -4,6 +4,31 @@ 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.27] 2022-02-11
### Improvements
- Arch:
- preventing AUR's installed packages from not being mapped in cases the communication with the API fails
- code refactoring (String formatting method)
- Setup
- able to install bauh with python/pip without enforcing requirements through the environment variable `BAUH_SETUP_NO_REQS=1`
- Distribution
- AppImage: -~32% size reduction (141.93 MB -> 96.32 MB)
### Fixes
- Arch
- silent crash when handling and displaying transaction sub-status
- AUR: not detecting installed packages anymore due to recent AUR API changes
- installation fails when several dependent packages conflict with the installed ones
- removing a duplicate call to checking for AUR updates
- AppImage
- search: displaying duplicate installed apps for some cases
## [0.9.26] 2022-01-31 ## [0.9.26] 2022-01-31
### Improvements ### Improvements

View File

@@ -17,7 +17,7 @@ Key features
## Index ## Index
1. [Installation](#installation) 1. [Installation](#installation)
- [AppImage](#inst_appimage) - [AppImage](#inst_appimage)
- [Ubuntu-based distros (20.04)](#inst_ubuntu) - [Ubuntu 20.04 based distros (Linux Mint, PopOS, ...)](#inst_ubuntu)
- [Arch-based distros](#inst_arch) - [Arch-based distros](#inst_arch)
2. [Isolated installation](#inst_iso) 2. [Isolated installation](#inst_iso)
3. [Desktop entry / menu shortcut](#desk_entry) 3. [Desktop entry / menu shortcut](#desk_entry)
@@ -56,7 +56,7 @@ Key features
- Run the following command through a terminal: `chmod a+x bauh-${version}-x86_64.AppImage` (replace `${version}` by the respective downloaded version) - Run the following command through a terminal: `chmod a+x bauh-${version}-x86_64.AppImage` (replace `${version}` by the respective downloaded version)
- Launch it: `./bauh-${version}-x86_64.AppImage` - Launch it: `./bauh-${version}-x86_64.AppImage`
#### <a name="inst_ubuntu">Ubuntu-based distros (20.04)</a> #### <a name="inst_ubuntu">Ubuntu 20.04 based distros (Linux Mint, PopOS, ...)</a>
##### Required dependencies ##### Required dependencies
@@ -66,6 +66,7 @@ Key features
`sudo pip3 install bauh` `sudo pip3 install bauh`
##### Optional dependencies (they should be installed with apt-get/apt) ##### Optional dependencies (they should be installed with apt-get/apt)
- `timeshift`: system backup - `timeshift`: system backup

View File

@@ -1,4 +1,4 @@
__version__ = '0.9.26' __version__ = '0.9.27'
__app_name__ = 'bauh' __app_name__ = 'bauh'
import os import os

View File

@@ -227,7 +227,7 @@ class AppImageManager(SoftwareManager):
installed_found.append(appim) installed_found.append(appim)
found = True found = True
if not found and lower_words in appim.name.lower() or (appim.description and lower_words in appim.description.lower()): if not found and (lower_words in appim.name.lower() or (appim.description and lower_words in appim.description.lower())):
installed_found.append(appim) installed_found.append(appim)
try: try:
apps_conn.close() apps_conn.close()

View File

@@ -112,12 +112,30 @@ class AURClient:
def search(self, words: str) -> dict: def search(self, words: str) -> dict:
return self.http_client.get_json(URL_SEARCH + words) return self.http_client.get_json(URL_SEARCH + words)
def get_info(self, names: Iterable[str]) -> List[dict]: def get_info(self, names: Iterable[str]) -> Optional[List[dict]]:
try: if names:
res = self.http_client.get_json(URL_INFO + self._map_names_as_queries(names)) try:
return res['results'] if res and res.get('results') else [] res = self.http_client.get_json(URL_INFO + self._map_names_as_queries(names))
except: except requests.exceptions.ConnectionError:
return [] self.logger.warning('Could not retrieve installed AUR packages API data. It seems the internet connection is off.')
return
if res is None:
self.logger.warning("Call to AUR API's info endpoint has failed")
return
error = res.get('error')
if error:
self.logger.warning(f"AUR API's info endpoint returned an unexpected error: {error}")
return
results = res.get('results')
if results is not None:
return results
self.logger.warning(f"AUR API's info endpoint returned an unexpected response: {res}")
def map_provided(self, pkgname: str, pkgver: str, provided: Optional[Iterable[str]] = None, strip_epoch: bool = True) -> Set[str]: def map_provided(self, pkgname: str, pkgver: str, provided: Optional[Iterable[str]] = None, strip_epoch: bool = True) -> Set[str]:
all_provided = {pkgname, f"{pkgname}={pkgver.split('-')[0] if strip_epoch else pkgver}"} all_provided = {pkgname, f"{pkgname}={pkgver.split('-')[0] if strip_epoch else pkgver}"}
@@ -130,31 +148,34 @@ class AURClient:
return all_provided return all_provided
def gen_updates_data(self, names: Iterable[str]) -> Generator[Tuple[str, dict], None, None]: def gen_updates_data(self, names: Iterable[str]) -> Generator[Tuple[str, dict], None, None]:
for package in self.get_info(names): pkgs_info = self.get_info(names)
pkgname, pkgver = package['Name'], package['Version'].split('-')[0]
deps = set() if pkgs_info:
for package in pkgs_info:
pkgname, pkgver = package['Name'], package['Version'].split('-')[0]
for dtype in ('Depends', 'MakeDepends', 'CheckDepends'): deps = set()
dep_set = package.get(dtype)
if dep_set:
deps.update(dep_set)
conflicts = set() for dtype in ('Depends', 'MakeDepends', 'CheckDepends'):
pkg_conflicts = package.get('Conflicts') dep_set = package.get(dtype)
if dep_set:
deps.update(dep_set)
if pkg_conflicts: conflicts = set()
conflicts.update(pkg_conflicts) pkg_conflicts = package.get('Conflicts')
yield pkgname, { if pkg_conflicts:
'v': pkgver, conflicts.update(pkg_conflicts)
'b': package.get('PackageBase', pkgname),
'r': 'aur', yield pkgname, {
'p': self.map_provided(pkgname=pkgname, pkgver=pkgver, provided=package.get('Provides'), strip_epoch=False), 'v': pkgver,
'd': deps, 'b': package.get('PackageBase', pkgname),
'c': conflicts, 'r': 'aur',
'ds': None, 'p': self.map_provided(pkgname=pkgname, pkgver=pkgver, provided=package.get('Provides'), strip_epoch=False),
's': None} 'd': deps,
'c': conflicts,
'ds': None,
's': None}
def get_src_info(self, name: str, real_name: Optional[str] = None) -> dict: def get_src_info(self, name: str, real_name: Optional[str] = None) -> dict:
srcinfo = self.srcinfo_cache.get(name) srcinfo = self.srcinfo_cache.get(name)
@@ -175,7 +196,7 @@ class AURClient:
self.logger.warning('No .SRCINFO found for {}'.format(name)) self.logger.warning('No .SRCINFO found for {}'.format(name))
self.logger.info('Checking if {} is based on another package'.format(name)) self.logger.info('Checking if {} is based on another package'.format(name))
# if was not found, it may be based on another package. # if was not found, it may be based on another package.
infos = self.get_info({name}) infos = self.get_info((name,))
if infos: if infos:
info = infos[0] info = infos[0]
@@ -214,8 +235,8 @@ class AURClient:
return self.extract_required_dependencies(info) return self.extract_required_dependencies(info)
def _map_names_as_queries(self, names) -> str: def _map_names_as_queries(self, names: Iterable[str]) -> str:
return '&'.join(['arg[{}]={}'.format(i, urllib.parse.quote(n)) for i, n in enumerate(names)]) return '&'.join((f'arg[]={urllib.parse.quote(n)}' for n in names))
def read_local_index(self) -> dict: def read_local_index(self) -> dict:
self.logger.info('Checking if the cached AUR index file exists') self.logger.info('Checking if the cached AUR index file exists')

View File

@@ -14,7 +14,6 @@ from pwd import getpwnam
from threading import Thread from threading import Thread
from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection, Generator from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection, Generator
import requests
from dateutil.parser import parse as parse_date from dateutil.parser import parse as parse_date
from bauh import __app_name__ from bauh import __app_name__
@@ -412,67 +411,72 @@ class ArchManager(SoftwareManager):
res.update_total() res.update_total()
return res return res
def _fill_aur_pkgs(self, aur_pkgs: dict, output: List[ArchPackage], disk_loader: DiskCacheLoader, internet_available: bool, def _fill_aur_pkgs_offline(self, aur_pkgs: dict, arch_config: dict, output: List[ArchPackage], disk_loader: Optional[DiskCacheLoader]):
self.logger.info("Reading cached data from installed AUR packages")
editable_pkgbuilds = self._read_editable_pkgbuilds() if arch_config['edit_aur_pkgbuild'] is not False else None
for name, data in aur_pkgs.items():
pkg = ArchPackage(name=name, version=data.get('version'),
latest_version=data.get('version'), description=data.get('description'),
installed=True, repository='aur', i18n=self.i18n)
pkg.categories = self.categories.get(pkg.name)
pkg.pkgbuild_editable = pkg.name in editable_pkgbuilds if editable_pkgbuilds is not None else None
if disk_loader:
disk_loader.fill(pkg)
pkg.status = PackageStatus.READY
output.append(pkg)
def _fill_aur_pkgs(self, aur_pkgs: dict, output: List[ArchPackage], disk_loader: Optional[DiskCacheLoader], internet_available: bool,
arch_config: dict, rebuild_check: Optional[Thread], rebuild_ignored: Optional[Thread], rebuild_output: Optional[Dict[str, Set[str]]]): arch_config: dict, rebuild_check: Optional[Thread], rebuild_ignored: Optional[Thread], rebuild_output: Optional[Dict[str, Set[str]]]):
if internet_available: if not internet_available:
try: self._fill_aur_pkgs_offline(aur_pkgs=aur_pkgs, arch_config=arch_config,
pkgsinfo = self.aur_client.get_info(aur_pkgs.keys()) output=output, disk_loader=disk_loader)
except requests.exceptions.ConnectionError: return
self.logger.warning('Could not retrieve installed AUR packages API data. It seems the internet connection is off.')
self.logger.info("Reading only local AUR packages data")
return
if pkgsinfo: pkgsinfo = self.aur_client.get_info(aur_pkgs.keys())
editable_pkgbuilds = self._read_editable_pkgbuilds() if arch_config['edit_aur_pkgbuild'] is not False else None
ignore_rebuild_check = None
if rebuild_ignored and rebuild_output is not None:
rebuild_ignored.join()
ignore_rebuild_check = rebuild_output['ignored']
to_rebuild = None
if rebuild_check and rebuild_output is not None:
self.logger.info("Waiting for rebuild-detector")
rebuild_check.join()
to_rebuild = rebuild_output['to_rebuild']
for pkgdata in pkgsinfo:
pkg = self.aur_mapper.map_api_data(pkgdata, aur_pkgs, self.categories)
pkg.pkgbuild_editable = pkg.name in editable_pkgbuilds if editable_pkgbuilds is not None else None
if pkg.installed:
if disk_loader:
disk_loader.fill(pkg, sync=True)
pkg.update = self._check_aur_package_update(pkg=pkg,
installed_data=aur_pkgs.get(pkg.name, {}),
api_data=pkgdata)
pkg.aur_update = pkg.update # used in 'set_rebuild_check'
if ignore_rebuild_check is not None:
pkg.allow_rebuild = pkg.name not in ignore_rebuild_check
if to_rebuild and not pkg.update and pkg.name in to_rebuild:
pkg.require_rebuild = True
pkg.update_state()
pkg.status = PackageStatus.READY
output.append(pkg)
if pkgsinfo is None:
self._fill_aur_pkgs_offline(aur_pkgs=aur_pkgs, arch_config=arch_config, output=output, disk_loader=disk_loader)
elif not pkgsinfo:
self.logger.warning("No data found for the supposed installed AUR packages returned from AUR API's info endpoint")
else: else:
editable_pkgbuilds = self._read_editable_pkgbuilds() if arch_config['edit_aur_pkgbuild'] is not False else None editable_pkgbuilds = self._read_editable_pkgbuilds() if arch_config['edit_aur_pkgbuild'] is not False else None
for name, data in aur_pkgs.items():
pkg = ArchPackage(name=name, version=data.get('version'),
latest_version=data.get('version'), description=data.get('description'),
installed=True, repository='aur', i18n=self.i18n)
pkg.categories = self.categories.get(pkg.name) ignore_rebuild_check = None
if rebuild_ignored and rebuild_output is not None:
rebuild_ignored.join()
ignore_rebuild_check = rebuild_output['ignored']
to_rebuild = None
if rebuild_check and rebuild_output is not None:
self.logger.info("Waiting for rebuild-detector")
rebuild_check.join()
to_rebuild = rebuild_output['to_rebuild']
for pkgdata in pkgsinfo:
pkg = self.aur_mapper.map_api_data(pkgdata, aur_pkgs, self.categories)
pkg.pkgbuild_editable = pkg.name in editable_pkgbuilds if editable_pkgbuilds is not None else None pkg.pkgbuild_editable = pkg.name in editable_pkgbuilds if editable_pkgbuilds is not None else None
if disk_loader: if pkg.installed:
disk_loader.fill(pkg) if disk_loader:
disk_loader.fill(pkg, sync=True)
pkg.update = self._check_aur_package_update(pkg=pkg,
installed_data=aur_pkgs.get(pkg.name, {}),
api_data=pkgdata)
pkg.aur_update = pkg.update # used in 'set_rebuild_check'
if ignore_rebuild_check is not None:
pkg.allow_rebuild = pkg.name not in ignore_rebuild_check
if to_rebuild and not pkg.update and pkg.name in to_rebuild:
pkg.require_rebuild = True
pkg.update_state()
pkg.status = PackageStatus.READY pkg.status = PackageStatus.READY
output.append(pkg) output.append(pkg)
@@ -1322,9 +1326,13 @@ class ArchManager(SoftwareManager):
else: else:
instances = None instances = None
provided_by_uninstalled = pacman.map_provided(pkgs=to_uninstall)
uninstalled = self._uninstall_pkgs(to_uninstall, context.root_password, context.handler, ignore_dependencies=skip_requirements) uninstalled = self._uninstall_pkgs(to_uninstall, context.root_password, context.handler, ignore_dependencies=skip_requirements)
if uninstalled: if uninstalled:
self._remove_uninstalled_from_context(provided_by_uninstalled, context)
if disk_loader: # loading package instances in case the uninstall succeeds if disk_loader: # loading package instances in case the uninstall succeeds
if instances: if instances:
for p in instances: for p in instances:
@@ -1395,6 +1403,22 @@ class ArchManager(SoftwareManager):
self._update_progress(context, 100) self._update_progress(context, 100)
return uninstalled return uninstalled
def _remove_uninstalled_from_context(self, provided_by_uninstalled: Dict[str, Set[str]], context: TransactionContext):
if context.provided_map and provided_by_uninstalled: # updating the current provided context
for name, provided in provided_by_uninstalled.items():
if name in context.provided_map:
del context.provided_map[name]
if provided:
for exp in provided:
exp_provided = context.provided_map.get(exp)
if exp_provided and name in exp_provided:
exp_provided.remove(name)
if not exp_provided:
del context.provided_map[exp]
def uninstall(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher, disk_loader: DiskCacheLoader) -> TransactionResult: def uninstall(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher, disk_loader: DiskCacheLoader) -> TransactionResult:
self.aur_client.clean_caches() self.aur_client.clean_caches()
@@ -1703,6 +1727,8 @@ class ArchManager(SoftwareManager):
res = self._uninstall(context=context, names={conflicting_pkg}, disk_loader=context.disk_loader, res = self._uninstall(context=context, names={conflicting_pkg}, disk_loader=context.disk_loader,
remove_unneeded=False, skip_requirements=skip_requirements) remove_unneeded=False, skip_requirements=skip_requirements)
context.restabilish_progress() context.restabilish_progress()
return res return res
@@ -1789,9 +1815,13 @@ class ArchManager(SoftwareManager):
if len(pkgnames) != len(pkg_repos): # checking if any dep not found in the distro repos are from AUR if len(pkgnames) != len(pkg_repos): # checking if any dep not found in the distro repos are from AUR
norepos = {p for p in pkgnames if p not in pkg_repos} norepos = {p for p in pkgnames if p not in pkg_repos}
for pkginfo in self.aur_client.get_info(norepos):
if pkginfo.get('Name') in norepos: aur_info = self.aur_client.get_info(norepos)
pkg_repos[pkginfo['Name']] = 'aur'
if aur_info:
for pkginfo in aur_info:
if pkginfo.get('Name') in norepos:
pkg_repos[pkginfo['Name']] = 'aur'
return pkg_repos return pkg_repos
@@ -2384,7 +2414,7 @@ class ArchManager(SoftwareManager):
if context.pkg and context.pkg.maintainer: if context.pkg and context.pkg.maintainer:
pkg_maintainer = context.pkg.maintainer pkg_maintainer = context.pkg.maintainer
elif context.repository == 'aur': elif context.repository == 'aur':
aur_infos = self.aur_client.get_info({context.name}) aur_infos = self.aur_client.get_info((context.name,))
pkg_maintainer = aur_infos[0].get('Maintainer') if aur_infos else None pkg_maintainer = aur_infos[0].get('Maintainer') if aur_infos else None
else: else:
pkg_maintainer = context.repository pkg_maintainer = context.repository
@@ -3482,7 +3512,7 @@ class ArchManager(SoftwareManager):
self.aur_client.clean_caches() self.aur_client.clean_caches()
apidatas = self.aur_client.get_info({pkg.name}) apidatas = self.aur_client.get_info((pkg.name,))
if not apidatas: if not apidatas:
watcher.show_message(title=self.i18n['error'], watcher.show_message(title=self.i18n['error'],

View File

@@ -264,24 +264,26 @@ class DependenciesAnalyser:
aur_search = self.aur_client.search(dep_name) aur_search = self.aur_client.search(dep_name)
if aur_search: if aur_search:
if dep_name == dep_exp: aur_results = aur_search.get('results')
version_required, exp_op = None, None
else:
split_informed_dep = self.re_dep_operator.split(dep_exp)
version_required = split_informed_dep[2]
exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '=='
for pkgname, pkgdata in self.aur_client.gen_updates_data( if aur_results:
(aur_res['Name'] for aur_res in aur_search['results'])): if dep_name == dep_exp:
if pkgname == dep_name or (dep_name in pkgdata['p']): version_required, exp_op = None, None
try: else:
if not version_required or match_required_version(pkgdata['v'], exp_op, split_informed_dep = self.re_dep_operator.split(dep_exp)
version_required): version_required = split_informed_dep[2]
yield pkgname, pkgdata exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '=='
except:
self._log.warning(f"Could not compare AUR package '{pkgname}' version '{pkgdata['v']}' " for pkgname, pkgdata in self.aur_client.gen_updates_data((aur_res['Name'] for aur_res in aur_results)):
f"with the dependency expression '{dep_exp}'") if pkgname == dep_name or (dep_name in pkgdata['p']):
traceback.print_exc() try:
if not version_required or match_required_version(pkgdata['v'], exp_op,
version_required):
yield pkgname, pkgdata
except:
self._log.warning(f"Could not compare AUR package '{pkgname}' version '{pkgdata['v']}' "
f"with the dependency expression '{dep_exp}'")
traceback.print_exc()
def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str], def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str],
missing_deps: Set[Tuple[str, str]], missing_deps: Set[Tuple[str, str]],
@@ -382,8 +384,9 @@ class DependenciesAnalyser:
raise PackageNotFoundException(dep_exp) raise PackageNotFoundException(dep_exp)
def _fill_aur_updates_data(self, pkgnames: Iterable[str], output_data: dict): def _fill_aur_updates_data(self, pkgnames: Iterable[str], output_data: dict):
for pkgname, pkgdata in self.aur_client.gen_updates_data(pkgnames): if pkgnames:
output_data[pkgname] = pkgdata for pkgname, pkgdata in self.aur_client.gen_updates_data(pkgnames):
output_data[pkgname] = pkgdata
def map_missing_deps(self, pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]], def map_missing_deps(self, pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]],
remote_provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str], remote_provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str],
@@ -516,9 +519,6 @@ class DependenciesAnalyser:
if repo_providers_data: if repo_providers_data:
deps_data.update(repo_providers_data) deps_data.update(repo_providers_data)
for pkgname, pkgdata in self.aur_client.gen_updates_data(aur_providers_no_data):
deps_data[pkgname] = pkgdata
if aur_data_filler: if aur_data_filler:
aur_data_filler.join() aur_data_filler.join()

View File

@@ -37,7 +37,7 @@ class TransactionStatusHandler(Thread):
def gen_percentage(self) -> str: def gen_percentage(self) -> str:
if self.percentage: if self.percentage:
performed = self.downloading + self.upgrading + self.installing performed = self.downloading + self.upgrading + self.installing
return '({0:.2f}%) '.format((performed / (2 * self.pkgs_to_sync)) * 100) return f'({(performed / (2 * self.pkgs_to_sync)) * 100:.2f}%) '
else: else:
return '' return ''
@@ -52,18 +52,19 @@ class TransactionStatusHandler(Thread):
if self.pkgs_to_remove > 0: if self.pkgs_to_remove > 0:
self.removing += 1 self.removing += 1
self.watcher.change_substatus('[{}/{}] {} {}'.format(self.removing, self.pkgs_to_remove, self.watcher.change_substatus(f"[{self.removing}/{self.pkgs_to_remove}] "
self.i18n['uninstalling'].capitalize(), output.split(' ')[1].strip())) f"{self.i18n['uninstalling'].capitalize()} {output.split(' ')[1].strip()}")
else: else:
self.watcher.change_substatus('{} {}'.format(self.i18n['uninstalling'].capitalize(), output_split[1].strip())) self.watcher.change_substatus(f"{self.i18n['uninstalling'].capitalize()} {output_split[1].strip()}")
elif output_split[1].lower().startswith('downloading') and (not self.names or (n for n in self.names if output_split[0].startswith(n))): elif len(output_split) >= 2 and output_split[1].lower().startswith('downloading') and (not self.names or (n for n in self.names if output_split[0].startswith(n))):
if self.downloading < self.pkgs_to_sync: if self.downloading < self.pkgs_to_sync:
perc = self.gen_percentage() perc = self.gen_percentage()
self.downloading += 1 self.downloading += 1
self.watcher.change_substatus('{}[{}/{}] {} {} {}'.format(perc, self.downloading, self.pkgs_to_sync, bold('[pacman]'), self.watcher.change_substatus(f"{perc}[{self.downloading}/{self.pkgs_to_sync}] {bold('[pacman]')} "
self.i18n['downloading'].capitalize(), output_split[0].strip())) f"{self.i18n['downloading'].capitalize()} {output_split[0].strip()}")
elif output_split[0].lower() == 'upgrading' and (not self.names or output_split[1].split('.')[0] in self.names): elif output_split[0].lower() == 'upgrading' and (not self.names or output_split[1].split('.')[0] in self.names):
if self.get_performed() < self.pkgs_to_sync: if self.get_performed() < self.pkgs_to_sync:
perc = self.gen_percentage() perc = self.gen_percentage()
@@ -72,8 +73,9 @@ class TransactionStatusHandler(Thread):
performed = self.upgrading + self.installing performed = self.upgrading + self.installing
if performed <= self.pkgs_to_sync: if performed <= self.pkgs_to_sync:
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, performed, self.pkgs_to_sync, self.watcher.change_substatus(f"{perc}[{performed}/{self.pkgs_to_sync}] "
self.i18n['manage_window.status.upgrading'].capitalize(), output_split[1].strip())) f"{self.i18n['manage_window.status.upgrading'].capitalize()} {output_split[1].strip()}")
elif output_split[0].lower() == 'installing' and (not self.names or output_split[1].split('.')[0] in self.names): elif output_split[0].lower() == 'installing' and (not self.names or output_split[1].split('.')[0] in self.names):
if self.get_performed() < self.pkgs_to_sync: if self.get_performed() < self.pkgs_to_sync:
perc = self.gen_percentage() perc = self.gen_percentage()
@@ -82,15 +84,14 @@ class TransactionStatusHandler(Thread):
performed = self.upgrading + self.installing performed = self.upgrading + self.installing
if performed <= self.pkgs_to_sync: if performed <= self.pkgs_to_sync:
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, performed, self.pkgs_to_sync, self.watcher.change_substatus(f"{perc}[{performed}/{self.pkgs_to_sync}] "
self.i18n['manage_window.status.installing'].capitalize(), f"{self.i18n['manage_window.status.installing'].capitalize()} {output_split[1].strip()}")
output_split[1].strip()))
else: else:
substatus_found = False substatus_found = False
lower_output = output.lower().strip() lower_output = output.lower().strip()
for msg, key in self.accepted.items(): for msg, key in self.accepted.items():
if lower_output.startswith(msg): if lower_output.startswith(msg):
self.watcher.change_substatus(self.i18n['arch.substatus.{}'.format(key)].capitalize()) self.watcher.change_substatus(self.i18n[f'arch.substatus.{key}'].capitalize())
substatus_found = True substatus_found = True
break break

View File

@@ -2,6 +2,14 @@ version: 1
script: script:
- rm -rf AppDir appimage-builder-cache *.AppImage *.zsync |true - rm -rf AppDir appimage-builder-cache *.AppImage *.zsync |true
- mkdir -p AppDir/usr - mkdir -p AppDir/usr
- mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps
- mkdir -p AppDir/usr/share/applications
- wget https://github.com/vinifmor/bauh/archive/${BAUH_VERSION}.tar.gz || exit 1
- BAUH_SETUP_NO_REQS=1 pip3 install ${BAUH_VERSION}.tar.gz --prefix=/usr --root=AppDir || exit 1
- tar -xf ${BAUH_VERSION}.tar.gz || exit 1
- cd bauh-${BAUH_VERSION} || exit 1
- cp bauh/view/resources/img/logo.svg ../AppDir/usr/share/icons/hicolor/scalable/apps/bauh.svg || exit 1
- cp bauh/desktop/bauh.desktop ../AppDir/usr/share/applications || exit 1
AppDir: AppDir:
@@ -14,7 +22,7 @@ AppDir:
version: !ENV ${BAUH_VERSION} version: !ENV ${BAUH_VERSION}
exec: /usr/bin/python3 exec: /usr/bin/python3
exec_args: "$APPDIR/usr/bin/bauh $@" exec_args: "$APPDIR/usr/bin/bauh $@"
apt: apt:
arch: amd64 arch: amd64
@@ -24,31 +32,40 @@ AppDir:
include: include:
- python3 - python3
- python3-pip
- python3-setuptools
- python3-wheel
- python3-requests - python3-requests
- python3-colorama - python3-colorama
- python3-dateutil - python3-dateutil
- python3-yaml - python3-yaml
- python3-packaging - python3-packaging
- python3-pyqt5
- python3-lxml - python3-lxml
- python3-bs4 - python3-bs4
- sqlite3 - sqlite3
- axel
- aria2
- wget - wget
- libfreetype6 # - libfreetype6
- libfontconfig1 # - libfontconfig1
exclude: [] exclude:
- dpkg
- apt
- aptitude
- python3-pip
- python3-setuptools
- python3-distutils
- libc-bin
- libc-dev-bin
- libc6
- libc6-dbg
- libc6-dev
after_bundle: after_bundle:
- pip3 install bauh==$BAUH_VERSION --prefix=/usr --root=AppDir - pip3 install pyqt5 --prefix=/usr --root=AppDir || exit 1
- mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps - cd AppDir/usr/lib/python3.8/site-packages/PyQt5/Qt5/plugins || exit 1
- cp AppDir/usr/lib/python3.8/site-packages/bauh/view/resources/img/logo.svg AppDir/usr/share/icons/hicolor/scalable/apps/bauh.svg - rm -rf audio gamepad gamepads geoservices printsupport sceneparsers sensorgestures sensors sqldrivers texttospeech webview || exit 1
- mkdir -p AppDir/usr/share/applications - cd ../
- cp AppDir/usr/lib/python3.8/site-packages/bauh/desktop/bauh.desktop AppDir/usr/share/applications - cd lib/ || exit 1
- rm libQt5Bluetooth.so.5 libQt5Designer.so.5 libQt5Multimedia.so.5 libQt5MultimediaGstTools.so.5 libQt5MultimediaWidgets.so.5 || exit 1
- rm libQt5Quick3D.so.5 libQt5Quick3DAssetImport.so.5 libQt5Quick3DRender.so.5 libQt5Quick3DRuntimeRender.so.5 libQt5QuickTest.so.5 || exit 1
- rm libQt5Quick3DUtils.so.5 libQt5PrintSupport.so.5 libQt5SerialPort.so.5 libQt5Sql.so.5 libQt5Sensors.so.5 libQt5Test.so.5 libQt5WebView.so.5 || exit 1
runtime: runtime:
version: "continuous" version: "continuous"

View File

@@ -14,8 +14,11 @@ URL = "https://github.com/vinifmor/" + NAME
file_dir = os.path.dirname(os.path.abspath(__file__)) file_dir = os.path.dirname(os.path.abspath(__file__))
with open(file_dir + '/requirements.txt', 'r') as f: if os.getenv('BAUH_SETUP_NO_REQS'):
requirements = [line.strip() for line in f.readlines() if line] requirements = []
else:
with open(f'{file_dir}/requirements.txt', 'r') as f:
requirements = [line.strip() for line in f.readlines() if line]
with open(file_dir + '/{}/__init__.py'.format(NAME), 'r') as f: with open(file_dir + '/{}/__init__.py'.format(NAME), 'r') as f: