mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
[debian] fix: packages descriptions are not displayed on the system's default language
This commit is contained in:
@@ -25,6 +25,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Arch
|
- Arch
|
||||||
- regression: not displaying ignored updates
|
- regression: not displaying ignored updates
|
||||||
|
|
||||||
|
- Debian
|
||||||
|
- packages descriptions are not displayed on the system's default language (when available)
|
||||||
|
|
||||||
- Flatpak:
|
- Flatpak:
|
||||||
- executed commands are not displayed on the system default language and encoding (requires Flatpak >= 1.12) [#242](https://github.com/vinifmor/bauh/issues/242)
|
- executed commands are not displayed on the system default language and encoding (requires Flatpak >= 1.12) [#242](https://github.com/vinifmor/bauh/issues/242)
|
||||||
- applications and runtimes descriptions are not displayed on the system default language (when available) [#242](https://github.com/vinifmor/bauh/issues/242)
|
- applications and runtimes descriptions are not displayed on the system default language (when available) [#242](https://github.com/vinifmor/bauh/issues/242)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Aptitude:
|
|||||||
self._size_attrs: Optional[Tuple[str]] = None
|
self._size_attrs: Optional[Tuple[str]] = None
|
||||||
self._default_lang = ''
|
self._default_lang = ''
|
||||||
self._ignored_fields: Optional[Set[str]] = None
|
self._ignored_fields: Optional[Set[str]] = None
|
||||||
|
self._re_none: Optional[Pattern] = None
|
||||||
|
|
||||||
def show(self, pkgs: Iterable[str], attrs: Optional[Collection[str]] = None, verbose: bool = False) \
|
def show(self, pkgs: Iterable[str], attrs: Optional[Collection[str]] = None, verbose: bool = False) \
|
||||||
-> Optional[Dict[str, Dict[str, object]]]:
|
-> Optional[Dict[str, Dict[str, object]]]:
|
||||||
@@ -135,11 +136,10 @@ class Aptitude:
|
|||||||
|
|
||||||
def upgrade(self, packages: Iterable[str], root_password: Optional[str]) -> SimpleProcess:
|
def upgrade(self, packages: Iterable[str], root_password: Optional[str]) -> SimpleProcess:
|
||||||
cmd = self.gen_transaction_cmd('upgrade', packages).split(' ')
|
cmd = self.gen_transaction_cmd('upgrade', packages).split(' ')
|
||||||
return SimpleProcess(cmd=cmd, shell=True, lang=self._default_lang,
|
return SimpleProcess(cmd=cmd, shell=True, root_password=root_password)
|
||||||
root_password=root_password)
|
|
||||||
|
|
||||||
def update(self, root_password: Optional[str]) -> SimpleProcess:
|
def update(self, root_password: Optional[str]) -> SimpleProcess:
|
||||||
return SimpleProcess(('aptitude', 'update'), root_password=root_password, shell=True, lang=self._default_lang)
|
return SimpleProcess(('aptitude', 'update'), root_password=root_password, shell=True)
|
||||||
|
|
||||||
def simulate_installation(self, packages: Iterable[str]) -> Optional[DebianTransaction]:
|
def simulate_installation(self, packages: Iterable[str]) -> Optional[DebianTransaction]:
|
||||||
code, output = system.execute(self.gen_transaction_cmd('install', packages, simulate=True),
|
code, output = system.execute(self.gen_transaction_cmd('install', packages, simulate=True),
|
||||||
@@ -150,7 +150,7 @@ class Aptitude:
|
|||||||
|
|
||||||
def install(self, packages: Iterable[str], root_password: Optional[str]) -> SimpleProcess:
|
def install(self, packages: Iterable[str], root_password: Optional[str]) -> SimpleProcess:
|
||||||
cmd = self.gen_transaction_cmd('install', packages).split(' ')
|
cmd = self.gen_transaction_cmd('install', packages).split(' ')
|
||||||
return SimpleProcess(cmd=cmd, shell=True, lang=self._default_lang, root_password=root_password)
|
return SimpleProcess(cmd=cmd, shell=True, root_password=root_password)
|
||||||
|
|
||||||
def read_installed(self) -> Generator[DebianPackage, None, None]:
|
def read_installed(self) -> Generator[DebianPackage, None, None]:
|
||||||
yield from self.search(query='~i')
|
yield from self.search(query='~i')
|
||||||
@@ -169,9 +169,7 @@ class Aptitude:
|
|||||||
|
|
||||||
def search(self, query: str, fill_size: bool = False) -> Generator[DebianPackage, None, None]:
|
def search(self, query: str, fill_size: bool = False) -> Generator[DebianPackage, None, None]:
|
||||||
attrs = f"%p^%v^%V^%m^%s^{'%I^' if fill_size else ''}%d"
|
attrs = f"%p^%v^%V^%m^%s^{'%I^' if fill_size else ''}%d"
|
||||||
_, output = system.execute(f"aptitude search {query} -q -F '{attrs}' --disable-columns",
|
_, output = system.execute(f"aptitude search {query} -q -F '{attrs}' --disable-columns", shell=True)
|
||||||
shell=True,
|
|
||||||
custom_env=self.env)
|
|
||||||
|
|
||||||
if output:
|
if output:
|
||||||
no_attrs = 7 if fill_size else 6
|
no_attrs = 7 if fill_size else 6
|
||||||
@@ -180,7 +178,7 @@ class Aptitude:
|
|||||||
line_split = line.strip().split('^', maxsplit=no_attrs - 1)
|
line_split = line.strip().split('^', maxsplit=no_attrs - 1)
|
||||||
|
|
||||||
if len(line_split) == no_attrs:
|
if len(line_split) == no_attrs:
|
||||||
latest_version = line_split[2] if line_split[2] != '<none>' else None
|
latest_version = line_split[2] if not self.re_none.match(line_split[2]) else None
|
||||||
|
|
||||||
size = None
|
size = None
|
||||||
|
|
||||||
@@ -195,7 +193,7 @@ class Aptitude:
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
if latest_version is not None:
|
if latest_version is not None:
|
||||||
installed_version = line_split[1] if line_split[1] != '<none>' else None
|
installed_version = line_split[1] if not self.re_none.match(line_split[1]) else None
|
||||||
section = strip_section(line_split[4])
|
section = strip_section(line_split[4])
|
||||||
|
|
||||||
yield DebianPackage(name=line_split[0],
|
yield DebianPackage(name=line_split[0],
|
||||||
@@ -214,7 +212,7 @@ class Aptitude:
|
|||||||
|
|
||||||
def remove(self, packages: Iterable[str], root_password: Optional[str], purge: bool = False) -> SimpleProcess:
|
def remove(self, packages: Iterable[str], root_password: Optional[str], purge: bool = False) -> SimpleProcess:
|
||||||
return SimpleProcess(cmd=self.gen_remove_cmd(packages, purge).split(' '), shell=True,
|
return SimpleProcess(cmd=self.gen_remove_cmd(packages, purge).split(' '), shell=True,
|
||||||
lang=self._default_lang, root_password=root_password)
|
root_password=root_password)
|
||||||
|
|
||||||
def read_installed_names(self) -> Generator[str, None, None]:
|
def read_installed_names(self) -> Generator[str, None, None]:
|
||||||
code, output = system.execute("aptitude search ~i -q -F '%p' --disable-columns",
|
code, output = system.execute("aptitude search ~i -q -F '%p' --disable-columns",
|
||||||
@@ -236,8 +234,7 @@ class Aptitude:
|
|||||||
@property
|
@property
|
||||||
def env(self) -> Dict[str, str]:
|
def env(self) -> Dict[str, str]:
|
||||||
if self._env is None:
|
if self._env is None:
|
||||||
self._env = system.gen_env(global_interpreter=system.USE_GLOBAL_INTERPRETER,
|
self._env = system.gen_env(global_interpreter=system.USE_GLOBAL_INTERPRETER)
|
||||||
lang=self._default_lang)
|
|
||||||
|
|
||||||
return self._env
|
return self._env
|
||||||
|
|
||||||
@@ -282,6 +279,13 @@ class Aptitude:
|
|||||||
f" -o Aptitude::ProblemResolver::EssentialRemoveScore=9999999" \
|
f" -o Aptitude::ProblemResolver::EssentialRemoveScore=9999999" \
|
||||||
f"{' -V -s -Z' if simulate else ''}"
|
f"{' -V -s -Z' if simulate else ''}"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def re_none(self) -> Pattern:
|
||||||
|
if self._re_none is None:
|
||||||
|
self._re_none = re.compile(r'^<\w+>$')
|
||||||
|
|
||||||
|
return self._re_none
|
||||||
|
|
||||||
|
|
||||||
class AptitudeOutputHandler(Thread):
|
class AptitudeOutputHandler(Thread):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user