Updated for binary size calculation

This commit is contained in:
Dimitris Zlatanidis 2023-11-25 17:28:17 +02:00
parent 8c3f1615c2
commit b693f387ef

View file

@ -1,7 +1,6 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
from typing import Any
from pathlib import Path
@ -108,9 +107,7 @@ class View(Configs):
version: str = self.data[package]['version']
if self.is_binary:
# size: str = self.utils.convert_file_sizes(int(self.data[package][4])) <- It's going to replace with this
size: str = self.utils.convert_file_sizes(
int(''.join(re.findall(r'\d+', self.data[package]['size_comp']))))
size: str = self.utils.convert_file_sizes(int(self.data[package]['size_comp']))
self.ascii.draw_package_line(package, version, size, color, self.repository)
@ -122,9 +119,7 @@ class View(Configs):
upgradable: bool = self.upgrade.is_package_upgradeable(package)
if self.is_binary:
# size: str = self.utils.convert_file_sizes(int(self.data[package][4])) <- It's going to replace with this
size: str = self.utils.convert_file_sizes(
int(''.join(re.findall(r'\d+', self.data[package]['size_comp']))))
size: str = self.utils.convert_file_sizes(int(self.data[package]['size_comp']))
if installed:
color: str = self.grey
@ -145,9 +140,7 @@ class View(Configs):
version: str = self.data[package]['version']
if self.is_binary:
# size: str = self.utils.convert_file_sizes(int(self.data[package][4])) <- It's going to replace with this
size: str = self.utils.convert_file_sizes(
int(''.join(re.findall(r'\d+', self.data[package]['size_comp']))))
size: str = self.utils.convert_file_sizes(int(self.data[package]['size_comp']))
self.ascii.draw_package_line(package, version, size, color, self.repository)
@ -176,10 +169,8 @@ class View(Configs):
installed: str = self.utils.is_package_installed(pkg)
if self.is_binary:
# size_comp += int(self.data[pkg][4]) <- It's going to replace with this
size_comp += int(''.join(re.findall(r'\d+', self.data[pkg]['size_comp'])))
# size_uncomp += int(self.data[pkg][5]) <- It's going to replace with this
size_uncomp += int(''.join(re.findall(r'\d+', self.data[pkg]['size_uncomp'])))
size_comp += int(self.data[pkg]['size_comp'])
size_uncomp += int(self.data[pkg]['size_uncomp'])
if installed and option == 'remove':
size_rmv += Path(self.log_packages, installed).stat().st_size