添加包的细节信息包下载安装大小,候选版本当前版本等等
This commit is contained in:
parent
bf2f976cf0
commit
cc99d9f10b
|
@ -38,8 +38,6 @@ import glob
|
|||
import json
|
||||
from gi.repository import Gio
|
||||
|
||||
import shutil
|
||||
from .utils import humanize_size
|
||||
from UpdateManager.Core import utils
|
||||
from UpdateManager.Core import filter
|
||||
|
||||
|
@ -509,21 +507,32 @@ class UpdateList():
|
|||
return False,header,desc
|
||||
|
||||
def _make_pkg_info_json(self,cache,pkgs_list):
|
||||
size = 0
|
||||
total_size = 0
|
||||
total_download_size = 0
|
||||
total_installed_size = 0
|
||||
pkgs_info_json = {}
|
||||
|
||||
for pkg_name in pkgs_list:
|
||||
try:
|
||||
pkg = cache[pkg_name]
|
||||
#当前版本
|
||||
cur_version = pkg.installed.version
|
||||
can_version = pkg.candidate.version
|
||||
|
||||
#获取下载大小
|
||||
size = getattr(pkg.candidate, "size", 0)
|
||||
total_size = total_size + size
|
||||
pkgs_info_json.update({pkg_name:{"size":size}})
|
||||
download_size = getattr(pkg.candidate, "size", 0)
|
||||
installed_size = getattr(pkg.candidate, "installed_size", 0)
|
||||
|
||||
total_download_size = total_download_size + download_size
|
||||
total_installed_size = total_installed_size + installed_size
|
||||
|
||||
pkgs_info_json.update({pkg_name:{"cur_version":cur_version,"can_version":can_version,\
|
||||
"download_size":download_size,"installed_size":installed_size}})
|
||||
|
||||
except Exception as e:
|
||||
logging.info("this package(%s) not in list and error mes:%s",pkg_name,e)
|
||||
pass
|
||||
pkgs_info_json.update({"total_size":total_size})
|
||||
|
||||
pkgs_info_json.update({"total_download_size":total_download_size})
|
||||
pkgs_info_json.update({"total_installed_size":total_installed_size})
|
||||
return pkgs_info_json
|
||||
|
||||
#检查包是否在cache中 返回新得列表
|
||||
|
|
|
@ -40,4 +40,3 @@ if __name__ == "__main__":
|
|||
|
||||
loop = GLib.MainLoop()
|
||||
loop.run()
|
||||
|
Loading…
Reference in New Issue