def start(self, auto_process=False): self.status = None self.db = DebconfCommunicator(PACKAGE, cloexec=True) prep = self.prepare() self.command = prep[0] question_patterns = prep[1] if len(prep) > 2: env = prep[2] else: env = {} self.ui_loop_level = 0 self.debug("Starting up '%s' for %s.%s", self.command, self.__class__.__module__, self.__class__.__name__) self.debug("Watching for question patterns %s", ', '.join(question_patterns)) widgets = {} for pattern in question_patterns: widgets[pattern] = self self.dbfilter = DebconfFilter(self.db, widgets) # TODO: Set as unseen all questions that we're going to ask. self.dbfilter.start(self.command, blocking=False, extra_env=env) # Clearly, this isn't enough for full non-blocking operation. # However, debconf itself is generally quick, and the confmodule # will generally be listening for a reply when we try to send one; # the slow bit is waiting for the confmodule to decide to send a # command. Therefore, this is the only file descriptor we bother to # watch, which greatly simplifies our life. self.frontend.watch_debconf_fd(self.dbfilter.subout_fd, self.process_input)