mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[debian] fix: displaying wrong symbols among numbers in transaction outputs for systems without english encoding installed
This commit is contained in:
@@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
- Debian
|
- Debian
|
||||||
- info: crashing when the package size has unexpected symbols [#251](https://github.com/vinifmor/bauh/issues/251)
|
- info: crashing when the package size has unexpected symbols [#251](https://github.com/vinifmor/bauh/issues/251)
|
||||||
|
- displaying wrong symbols among numbers in install/uninstall/upgrade outputs for systems without english encoding installed
|
||||||
|
|
||||||
- UI
|
- UI
|
||||||
- not displaying the right unit symbol for byte based sizes (kB, MB, TB, ...) [#250](https://github.com/vinifmor/bauh/issues/250)
|
- not displaying the right unit symbol for byte based sizes (kB, MB, TB, ...) [#250](https://github.com/vinifmor/bauh/issues/250)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Aptitude:
|
|||||||
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
|
self._re_none: Optional[Pattern] = None
|
||||||
|
self._vars_encoding_fix: Optional[Dict[str, str]] = 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]]]:
|
||||||
@@ -128,7 +129,7 @@ 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, root_password=root_password)
|
return SimpleProcess(cmd=cmd, shell=True, root_password=root_password, extra_env=self.vars_encoding_fix)
|
||||||
|
|
||||||
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)
|
return SimpleProcess(('aptitude', 'update'), root_password=root_password, shell=True)
|
||||||
@@ -142,7 +143,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, root_password=root_password)
|
return SimpleProcess(cmd=cmd, shell=True, root_password=root_password, extra_env=self.vars_encoding_fix)
|
||||||
|
|
||||||
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')
|
||||||
@@ -199,7 +200,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,
|
||||||
root_password=root_password)
|
root_password=root_password, extra_env=self.vars_encoding_fix)
|
||||||
|
|
||||||
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",
|
||||||
@@ -274,6 +275,13 @@ class Aptitude:
|
|||||||
|
|
||||||
return self._re_none
|
return self._re_none
|
||||||
|
|
||||||
|
@property
|
||||||
|
def vars_encoding_fix(self) -> Dict[str, str]:
|
||||||
|
if self._vars_encoding_fix is None:
|
||||||
|
self._vars_encoding_fix = {'LC_NUMERIC': ''}
|
||||||
|
|
||||||
|
return self._vars_encoding_fix
|
||||||
|
|
||||||
|
|
||||||
class AptitudeOutputHandler(Thread):
|
class AptitudeOutputHandler(Thread):
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ Description: GNU C compiler
|
|||||||
def test_show__all_attributes(self, execute: Mock):
|
def test_show__all_attributes(self, execute: Mock):
|
||||||
info = self.aptitude.show(('firefox', 'gcc'))
|
info = self.aptitude.show(('firefox', 'gcc'))
|
||||||
execute.assert_called_once_with('aptitude show -q firefox gcc', shell=True,
|
execute.assert_called_once_with('aptitude show -q firefox gcc', shell=True,
|
||||||
custom_env=system.gen_env(global_interpreter=system.USE_GLOBAL_INTERPRETER,
|
custom_env={**system.gen_env(global_interpreter=system.USE_GLOBAL_INTERPRETER,
|
||||||
lang=''))
|
lang=''), 'LC_NUMERIC': ''})
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
'firefox': {
|
'firefox': {
|
||||||
|
|||||||
Reference in New Issue
Block a user