mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[arch] fix: package sizes float conversion error
This commit is contained in:
@@ -508,7 +508,7 @@ def map_update_sizes(pkgs: List[str]) -> Dict[str, int]: # bytes:
|
|||||||
output = run_cmd('pacman -Si {}'.format(' '.join(pkgs)))
|
output = run_cmd('pacman -Si {}'.format(' '.join(pkgs)))
|
||||||
|
|
||||||
if output:
|
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 {}
|
return {}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ def map_download_sizes(pkgs: List[str]) -> Dict[str, int]: # bytes:
|
|||||||
output = run_cmd('pacman -Si {}'.format(' '.join(pkgs)))
|
output = run_cmd('pacman -Si {}'.format(' '.join(pkgs)))
|
||||||
|
|
||||||
if output:
|
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 {}
|
return {}
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ def get_installed_size(pkgs: List[str]) -> Dict[str, int]: # bytes
|
|||||||
output = run_cmd('pacman -Qi {}'.format(' '.join(pkgs)))
|
output = run_cmd('pacman -Qi {}'.format(' '.join(pkgs)))
|
||||||
|
|
||||||
if output:
|
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 {}
|
return {}
|
||||||
|
|
||||||
@@ -688,11 +688,11 @@ def map_updates_data(pkgs: Iterable[str], files: bool = False) -> dict:
|
|||||||
latest_field = 'c'
|
latest_field = 'c'
|
||||||
elif field == 'Download Size':
|
elif field == 'Download Size':
|
||||||
size = val.split(' ')
|
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'
|
latest_field = 'ds'
|
||||||
elif field == 'Installed Size':
|
elif field == 'Installed Size':
|
||||||
size = val.split(' ')
|
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'
|
latest_field = 's'
|
||||||
elif latest_name and latest_field == 's':
|
elif latest_name and latest_field == 's':
|
||||||
res[latest_name] = data
|
res[latest_name] = data
|
||||||
|
|||||||
Reference in New Issue
Block a user