From f44097ad7e4375c11da8eb8ba82119440d4aa073 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 28 Mar 2022 10:56:14 -0300 Subject: [PATCH] [arch] fix: package sizes float conversion error --- bauh/gems/arch/pacman.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index f7382f4a..e9a35a0c 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -508,7 +508,7 @@ def map_update_sizes(pkgs: List[str]) -> Dict[str, int]: # bytes: output = run_cmd('pacman -Si {}'.format(' '.join(pkgs))) if output: - return {pkgs[idx]: size_to_byte(float(size[0]), size[1]) for idx, size in enumerate(RE_INSTALLED_SIZE.findall(output))} + return {pkgs[idx]: size_to_byte(float(size[0].replace(',', '.')), size[1]) for idx, size in enumerate(RE_INSTALLED_SIZE.findall(output))} return {} @@ -517,7 +517,7 @@ def map_download_sizes(pkgs: List[str]) -> Dict[str, int]: # bytes: output = run_cmd('pacman -Si {}'.format(' '.join(pkgs))) if output: - return {pkgs[idx]: size_to_byte(float(size[0]), size[1]) for idx, size in enumerate(RE_DOWNLOAD_SIZE.findall(output))} + return {pkgs[idx]: size_to_byte(float(size[0].replace(',', '.')), size[1]) for idx, size in enumerate(RE_DOWNLOAD_SIZE.findall(output))} return {} @@ -526,7 +526,7 @@ def get_installed_size(pkgs: List[str]) -> Dict[str, int]: # bytes output = run_cmd('pacman -Qi {}'.format(' '.join(pkgs))) if output: - return {pkgs[idx]: size_to_byte(float(size[0]), size[1]) for idx, size in enumerate(RE_INSTALLED_SIZE.findall(output))} + return {pkgs[idx]: size_to_byte(float(size[0].replace(',', '.')), size[1]) for idx, size in enumerate(RE_INSTALLED_SIZE.findall(output))} return {} @@ -688,11 +688,11 @@ def map_updates_data(pkgs: Iterable[str], files: bool = False) -> dict: latest_field = 'c' elif field == 'Download Size': size = val.split(' ') - data['ds'] = size_to_byte(float(size[0]), size[1]) + data['ds'] = size_to_byte(float(size[0].replace(',', '.')), size[1]) latest_field = 'ds' elif field == 'Installed Size': size = val.split(' ') - data['s'] = size_to_byte(float(size[0]), size[1]) + data['s'] = size_to_byte(float(size[0].replace(',', '.')), size[1]) latest_field = 's' elif latest_name and latest_field == 's': res[latest_name] = data