mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 05:14:16 +02:00
[arch] improvement -> info window: date fields format changed to numbers
This commit is contained in:
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Arch
|
- Arch
|
||||||
- AUR: upgrade checking now considers modification dates as well (needed because not all AUR packages follow versioning standards)
|
- AUR: upgrade checking now considers modification dates as well (needed because not all AUR packages follow versioning standards)
|
||||||
- the task responsible for generating a local AUR index is displayed on the initialization dialog
|
- the task responsible for generating a local AUR index is displayed on the initialization dialog
|
||||||
|
- info window:
|
||||||
|
- date fields format changed to numbers (e.g: Thu Dec 17 17:19:55 2020 -> 2020-12-17 17:19:55)
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- AppImage
|
- AppImage
|
||||||
|
|||||||
@@ -1370,6 +1370,7 @@ class ArchManager(SoftwareManager):
|
|||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
info = pacman.get_info_dict(pkg.name)
|
info = pacman.get_info_dict(pkg.name)
|
||||||
|
self._parse_dates_string_from_info(pkg.name, info)
|
||||||
|
|
||||||
if pkg.last_modified:
|
if pkg.last_modified:
|
||||||
info['last_modified'] = self._parse_timestamp(ts=pkg.last_modified,
|
info['last_modified'] = self._parse_timestamp(ts=pkg.last_modified,
|
||||||
@@ -1430,16 +1431,27 @@ class ArchManager(SoftwareManager):
|
|||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
def _parse_dates_string_from_info(self, pkgname: str, info: dict):
|
||||||
|
for date_attr in ('install date', 'build date'):
|
||||||
|
en_date_str = info.get(date_attr)
|
||||||
|
|
||||||
|
if en_date_str:
|
||||||
|
try:
|
||||||
|
info[date_attr] = parse_date(en_date_str)
|
||||||
|
except ValueError:
|
||||||
|
self.logger.error("Could not parse date attribute '{}' ({}) from package '{}'".format(date_attr, en_date_str, pkgname))
|
||||||
|
|
||||||
def _parse_timestamp(self, ts: int, error_msg: str) -> datetime:
|
def _parse_timestamp(self, ts: int, error_msg: str) -> datetime:
|
||||||
if ts:
|
if ts:
|
||||||
try:
|
try:
|
||||||
return datetime.fromtimestamp(ts)
|
return datetime.fromtimestamp(ts)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if error_msg:
|
if error_msg:
|
||||||
self.logger.warning(error_msg)
|
self.logger.error(error_msg)
|
||||||
|
|
||||||
def _get_info_repo_pkg(self, pkg: ArchPackage) -> dict:
|
def _get_info_repo_pkg(self, pkg: ArchPackage) -> dict:
|
||||||
info = pacman.get_info_dict(pkg.name, remote=not pkg.installed)
|
info = pacman.get_info_dict(pkg.name, remote=not pkg.installed)
|
||||||
|
self._parse_dates_string_from_info(pkg.name, info)
|
||||||
if pkg.installed:
|
if pkg.installed:
|
||||||
info['installed files'] = pacman.list_installed_files(pkg.name)
|
info['installed files'] = pacman.list_installed_files(pkg.name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user