나는 python_apt
에서 제공하는이 코드를 체크 아웃하고있어하지만 오래된 조금 것으로 보인다 :apt.progress 클래스를 사용하여 python_apt에서 commit() 진행 상황을 확인하는 방법은 무엇입니까?
https://github.com/jolicloud/python-apt/blob/master/doc/examples/inst.py
내가 여기서 뭘하려고 해요 모두가 commit()
방법의 진행에 따라입니다; 현재 commit()
을 호출하고 fprogress
과 iprogress
을 전달하면 pkg_list
에있는 모든 패키지가 올바르게 다운로드되었음을 콘솔에서 볼 수 있습니다. 문제는이 이후에 나타납니다.
프로그램이 실행을 계속하고 그것이 실행해야한다고 생각하는대로 dpkg_status_change()
을 트리거하지 않습니다?
여러 패키지를 성공적으로 설치했는지 알 수 없습니까? 분명히 python_apt
commit()
작업
import apt
from apt.progress.base import InstallProgress
class InstallStatusUpdate(InstallProgress):
def conffile(self, current, new):
print "conffile prompt: %s %s" % (current, new)
def processing(self, pkg, stage):
print "Processing ", pkg, " stage: ", stage
def error(self, pkg, errormsg):
print "Package ", pkg, " error: ", errormsg
def finish_update(self):
print "Installation is complete"
def status_change(self, pkg, percent, status):
print "Package: ", pkg, " at ", percent, " -> ", status
def dpkg_status_change(self, pkg, status):
print "Package ", pkg, ", Status: ", status
def install_updates(self, pkg_list):
fprogress = apt.progress.TextFetchProgress()
iprogress = InstallStatusUpdate()
cache_tmp = apt.Cache()
cache_tmp.update()
cache_tmp.open(None)
for pkg in pkg_list:
try:
self.pkgname = cache_tmp[pkg.name]
if self.pkgname.is_installed and self.pkgname.is_upgradable:
self.pkgname.mark_upgrade()
else:
self.pkgname.mark_install()
except Exception as e:
print e.message
result = self.pkgname.commit(fprogress, iprogress)
#Maybe i'm doing something wrong here but result always = None...