mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[debian] fix: displaying wrong symbols among numbers in transaction outputs for systems without english encoding installed
This commit is contained in:
@@ -46,6 +46,7 @@ class Aptitude:
|
||||
self._default_lang = ''
|
||||
self._ignored_fields: Optional[Set[str]] = 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) \
|
||||
-> Optional[Dict[str, Dict[str, object]]]:
|
||||
@@ -128,7 +129,7 @@ class Aptitude:
|
||||
|
||||
def upgrade(self, packages: Iterable[str], root_password: Optional[str]) -> SimpleProcess:
|
||||
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:
|
||||
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:
|
||||
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]:
|
||||
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:
|
||||
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]:
|
||||
code, output = system.execute("aptitude search ~i -q -F '%p' --disable-columns",
|
||||
@@ -274,6 +275,13 @@ class Aptitude:
|
||||
|
||||
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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user