def _run_lintian(self, filename):
buf = self.textview_lintian_output.get_buffer()
if not os.path.exists("/usr/bin/lintian"):
buf.set_text(
_("No lintian available.\n"
"Please install using sudo apt-get install lintian"))
return
buf.set_text(_("Running lintian..."))
self._lintian_output = ""
self._lintian_exit_status = None
self._lintian_exit_status_gathered = None
cmd = ["/usr/bin/lintian", filename]
(pid, stdin, stdout, stderr) = GLib.spawn_async(
cmd, flags=GObject.SPAWN_DO_NOT_REAP_CHILD,
standard_output=True, standard_error=True)
for fd in [stdout, stderr]:
channel = GLib.IOChannel(filedes=fd)
channel.set_flags(GLib.IOFlags.NONBLOCK)
GLib.io_add_watch(channel, GLib.PRIORITY_DEFAULT,
GLib.IOCondition.IN | GLib.IO_ERR | GLib.IO_HUP,
self._on_lintian_output)
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid,
self._on_lintian_finished)
评论列表
文章目录