def _stdout(self, l): if l.startswith("I: Validating") or l.startswith("I: Extracting") or l.startswith("I: Configuring") or l.startswith("I: Unpacking"): self._done_packs += 1 elif l == "I: Base system installed successfully.": self._done_packs = self._tot_packs prog = self._done_packs/float(self._tot_packs) host.progress(prog, l) return True
def _dpkg_status(self, f, ev): if ev != select.POLLIN: return False st = [ x.strip() for x in f.readline().split(":") ] if st[0] == "status" and st[-1] == "installed": self._done += 1.0 host.progress(float(self._done)/self._items) return True
def _apt_status(self, f, ev): if ev != select.POLLIN: return False st = f.readline().strip().split(":") prog = 0.0 if st[0] == "dlstatus" or st[0] == "pmstatus": prog = self._prog_set(st[0], float(st[2])) else: return True host.progress(prog, st[3]) return True
def _stdout(self, line): if line.find("upgraded, ") < line.find("newly installed, "): # Use re p = line.split(",")[1].strip().split(" ")[0] self._items += int(p) if not self._items: return True if line.startswith("Get:"): self._done+=0.5 elif line.startswith("I:"): self._done+=0.5 host.progress(float(self._done)/self._items) return True