From 26d4ca58c95a386e2ff2e2e5e6b50ec1468b5f86 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 8 Jan 2008 16:09:10 +0100 Subject: doc/examples/gui-inst.py: - update to reflect the current features --- doc/examples/gui-inst.py | 55 ++++++++++++------------------------------------ 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index deb325fe..c2555134 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -48,6 +48,7 @@ class GuiFetchProgress(gtk.Window, FetchProgress): class TermInstallProgress(InstallProgress, gtk.Window): def __init__(self): gtk.Window.__init__(self) + InstallProgress.__init__(self) self.show() box = gtk.VBox() box.show() @@ -58,62 +59,32 @@ class TermInstallProgress(InstallProgress, gtk.Window): self.reaper = vte.reaper_get() self.reaper.connect("child-exited",self.child_exited) self.finished = False - box.pack_start(self.term) self.progressbar = gtk.ProgressBar() self.progressbar.show() box.pack_start(self.progressbar) - - (read, write) = os.pipe() - self.writefd=write - self.status = os.fdopen(read, "r") - fcntl.fcntl(self.status.fileno(), fcntl.F_SETFL,os.O_NONBLOCK) - print "read-fd: %s" % self.status.fileno() - print "write-fd: %s" % self.writefd - self.read = "" - def child_exited(self,term, pid, status): print "child_exited: %s %s %s %s" % (self,term,pid,status) self.apt_status = posix.WEXITSTATUS(status) self.finished = True - def startUpdate(self): print "start" self.show() - def updateInterface(self): - if self.status != None: - try: - self.read += os.read(self.status.fileno(),1) - except OSError, (errno,errstr): - # resource temporarly unavailable is ignored - if errno != 11: - print errstr - if self.read.endswith("\n"): - s = self.read - print s - (status, pkg, percent, status_str) = string.split(s, ":") - print "percent: %s %s" % (pkg, float(percent)/100.0) - self.progressbar.set_fraction(float(percent)/100.0) - self.progressbar.set_text(string.strip(status_str)) - self.read = "" - while gtk.events_pending(): - gtk.main_iteration() - - def finishUpdate(self): - sys.stdin.readline() - def run(self, pm): - print "fork" - env = ["VTE_PTY_KEEP_FD=%s"%self.writefd] - print env - pid = self.term.forkpty(envv=env) - if pid == 0: - res = pm.DoInstall(self.writefd) - print res - sys.exit(res) - print "After fork: %s " % pid + def waitChild(self): while not self.finished: self.updateInterface() + while gtk.events_pending(): + gtk.main_iteration() + time.sleep(0.001) + sys.stdin.readline() return self.apt_status + def statusChange(self, pkg, percent, status): + print "statusChange", pkg, percent + self.progressbar.set_fraction(float(percent)/100.0) + self.progressbar.set_text(string.strip(status)) + def fork(self): + env = ["VTE_PTY_KEEP_FD=%s"%self.writefd] + return self.term.forkpty(envv=env) cache = apt.Cache() print "Available packages: %s " % cache._cache.PackageCount -- cgit v1.2.3 From fd183f637afc8786991782d2135f8885c8490fc2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 18 Jan 2008 17:02:12 +0100 Subject: * python/tar.cc: - fix .lzma extraction (thanks to bigjools) --- debian/changelog | 2 ++ python/tar.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/debian/changelog b/debian/changelog index 54859732..e3d4e109 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ python-apt (0.7.5) UNRELEASED; urgency=low * use the new CacheFile::ListUpdate() code * add example in doc/examples/update.py + * python/tar.cc: + - fix .lzma extraction (thanks to bigjools) -- Michael Vogt Fri, 04 Jan 2008 21:17:00 +0100 diff --git a/python/tar.cc b/python/tar.cc index 22c0327e..61c9d708 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -168,6 +168,8 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) // Extract it. if (strcmp(".bz2", &Chunk[strlen(Chunk)-4]) == 0) Comp = "bzip2"; + else if(strcmp(".lzma", &Chunk[strlen(Chunk)-5]) == 0) + Comp = "lzma"; ExtractTar Tar(Deb.GetFile(),Member->Size,Comp); ProcessTar Proc(Function); if (Tar.Go(Proc) == false) -- cgit v1.2.3