Merge lp:~mvo/gdebi/add-linitan into lp:gdebi

Proposed by Michael Vogt
Status: Merged
Merged at revision: 442
Proposed branch: lp:~mvo/gdebi/add-linitan
Merge into: lp:gdebi
Diff against target: 921 lines (+242/-107) (has conflicts)
4 files modified
GDebi/GDebi.py (+109/-45)
GDebi/GDebiCommon.py (+9/-8)
data/gdebi.ui (+61/-54)
tests/test_gdebi_gtk_lintian.py (+63/-0)
Text conflict in GDebi/GDebi.py
To merge this branch: bzr merge lp:~mvo/gdebi/add-linitan
Reviewer Review Type Date Requested Status
gdebi-developers Pending
Review via email: mp+128427@code.launchpad.net

Description of the change

This branch adds a "lintian" tab to the main notebook that show the
lintian status of the deb in question

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'GDebi/GDebi.py'
--- GDebi/GDebi.py 2012-10-05 10:32:37 +0000
+++ GDebi/GDebi.py 2012-10-08 06:56:32 +0000
@@ -52,7 +52,7 @@
52from gettext import gettext as _52from gettext import gettext as _
5353
54# the timeout when the termial is expanded if no activity from dpkg54# the timeout when the termial is expanded if no activity from dpkg
55# is happening 55# is happening
56GDEBI_TERMINAL_TIMEOUT=4*60.056GDEBI_TERMINAL_TIMEOUT=4*60.0
5757
58# HACK - there are two ubuntu specific patches, one for VTE, one58# HACK - there are two ubuntu specific patches, one for VTE, one
@@ -67,7 +67,7 @@
67class GDebi(SimpleGtkbuilderApp, GDebiCommon):67class GDebi(SimpleGtkbuilderApp, GDebiCommon):
6868
69 def __init__(self, datadir, options, file=""):69 def __init__(self, datadir, options, file=""):
70 GDebiCommon.__init__(self,datadir,options,file)70 GDebiCommon.__init__(self,datadir, options, file)
71 localesApp="gdebi"71 localesApp="gdebi"
72 localesDir="/usr/share/locale"72 localesDir="/usr/share/locale"
7373
@@ -79,13 +79,13 @@
79 logo=icons.load_icon("gnome-mime-application-x-deb", 48, 0)79 logo=icons.load_icon("gnome-mime-application-x-deb", 48, 0)
80 if logo != "":80 if logo != "":
81 Gtk.Window.set_default_icon_list([logo])81 Gtk.Window.set_default_icon_list([logo])
82 except Exception, e:82 except Exception as e:
83 print "Error loading logo"83 print "Error loading logo"
84 pass84 pass
8585
86 # create terminal86 # create terminal
87 self.vte_terminal = Vte.Terminal()87 self.vte_terminal = Vte.Terminal()
88 # FIXME: this sucks but without it the terminal window is only 88 # FIXME: this sucks but without it the terminal window is only
89 # 1 line height89 # 1 line height
90 self.vte_terminal.set_size_request(80*10, 25*10)90 self.vte_terminal.set_size_request(80*10, 25*10)
91 menu = Gtk.Menu()91 menu = Gtk.Menu()
@@ -124,7 +124,7 @@
124 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)124 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)
125 sys.exit(1)125 sys.exit(1)
126 self.statusbar_main.push(self.context, "")126 self.statusbar_main.push(self.context, "")
127 127
128 # setup the details treeview128 # setup the details treeview
129 self.details_list = Gtk.ListStore(GObject.TYPE_STRING)129 self.details_list = Gtk.ListStore(GObject.TYPE_STRING)
130 column = Gtk.TreeViewColumn("")130 column = Gtk.TreeViewColumn("")
@@ -145,6 +145,7 @@
145 self.synaptic_config = apt_pkg.Configuration()145 self.synaptic_config = apt_pkg.Configuration()
146146
147 if file != "" and os.path.exists(file):147 if file != "" and os.path.exists(file):
148<<<<<<< TREE
148 self.open(file)149 self.open(file)
149 self.window_main.set_sensitive(True)150 self.window_main.set_sensitive(True)
150151
@@ -158,6 +159,15 @@
158 Gtk.main_iteration() 159 Gtk.main_iteration()
159 else:160 else:
160 win.set_cursor(None)161 win.set_cursor(None)
162=======
163 self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
164 while Gtk.events_pending():
165 Gtk.main_iteration()
166 self.open(file)
167 self.window_main.get_window().set_cursor(None)
168
169 self.window_main.set_sensitive(True)
170>>>>>>> MERGE-SOURCE
161171
162 def gio_progress_callback(self, bytes_read, bytes_total, data):172 def gio_progress_callback(self, bytes_read, bytes_total, data):
163 self.progressbar_download.set_fraction(bytes_read/float(bytes_total))173 self.progressbar_download.set_fraction(bytes_read/float(bytes_total))
@@ -173,7 +183,7 @@
173 if (gio_file.get_uri_scheme() == "file"):183 if (gio_file.get_uri_scheme() == "file"):
174 return file184 return file
175 if (os.getuid()==0):185 if (os.getuid()==0):
176 self.show_alert(Gtk.MessageType.ERROR, 186 self.show_alert(Gtk.MessageType.ERROR,
177 _("Can not download as root"),187 _("Can not download as root"),
178 _("Remote packages can not be downloaded when "188 _("Remote packages can not be downloaded when "
179 "running as root. Please try again as a "189 "running as root. Please try again as a "
@@ -194,7 +204,7 @@
194 file = gio_dest.get_path()204 file = gio_dest.get_path()
195 self.dialog_gio_download.hide()205 self.dialog_gio_download.hide()
196 except Exception, e:206 except Exception, e:
197 self.show_alert(Gtk.MessageType.ERROR, 207 self.show_alert(Gtk.MessageType.ERROR,
198 _("Download failed"),208 _("Download failed"),
199 _("Downloading the package failed: "209 _("Downloading the package failed: "
200 "file '%s' '%s'") % (file, e))210 "file '%s' '%s'") % (file, e))
@@ -213,7 +223,7 @@
213 elif path.startswith('file:'): # xffm223 elif path.startswith('file:'): # xffm
214 path = path[5:] # 5 is len('file:')224 path = path[5:] # 5 is len('file:')
215 return path225 return path
216 226
217 def on_menuitem_quit_activate(self, widget):227 def on_menuitem_quit_activate(self, widget):
218 try:228 try:
219 Gtk.main_quit()229 Gtk.main_quit()
@@ -230,20 +240,31 @@
230 path = self._get_file_path_from_dnd_dropped_uri(uri)240 path = self._get_file_path_from_dnd_dropped_uri(uri)
231 #print 'path to open', path241 #print 'path to open', path
232 if path.endswith(".deb"):242 if path.endswith(".deb"):
243<<<<<<< TREE
244=======
245 self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
246 while Gtk.events_pending():
247 Gtk.main_iteration()
248>>>>>>> MERGE-SOURCE
233 self.open(path)249 self.open(path)
234250
251<<<<<<< TREE
235 def open(self, file, downloaded=False):252 def open(self, file, downloaded=False):
236 self._show_busy_cursor(True)253 self._show_busy_cursor(True)
237 res = GDebiCommon.open(self, file, downloaded)254 res = GDebiCommon.open(self, file, downloaded)
238 self._show_busy_cursor(False)255 self._show_busy_cursor(False)
256=======
257 def open(self, filename, downloaded=False):
258 res = GDebiCommon.open(self, filename, downloaded)
259>>>>>>> MERGE-SOURCE
239 if res == False:260 if res == False:
240 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)261 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)
241 return False262 return False
242 263
243 self.statusbar_main.push(self.context, "")264 self.statusbar_main.push(self.context, "")
244265
245 # set window title266 # set window title
246 self.window_main.set_title(_("Package Installer - %s") % 267 self.window_main.set_title(_("Package Installer - %s") %
247 self._deb.pkgname)268 self._deb.pkgname)
248269
249 # set name and ungrey some widgets270 # set name and ungrey some widgets
@@ -315,6 +336,11 @@
315 # and the file content textview336 # and the file content textview
316 font_desc = Pango.FontDescription('monospace')337 font_desc = Pango.FontDescription('monospace')
317 self.textview_file_content.modify_font(font_desc)338 self.textview_file_content.modify_font(font_desc)
339 self.textview_lintian_output.modify_font(font_desc)
340
341 # run lintian async
342 if self._options and self._options.non_interactive is False:
343 self._run_lintian(filename)
318344
319 # check the deps345 # check the deps
320 if not self._deb.check():346 if not self._deb.check():
@@ -322,7 +348,7 @@
322 "<span foreground=\"red\" weight=\"bold\">"+348 "<span foreground=\"red\" weight=\"bold\">"+
323 _("Error: ") +349 _("Error: ") +
324 #glib.markup_escape_text(self._deb._failure_string) +350 #glib.markup_escape_text(self._deb._failure_string) +
325 self._deb._failure_string + 351 self._deb._failure_string +
326 "</span>")352 "</span>")
327 self.button_install.set_label(_("_Install Package"))353 self.button_install.set_label(_("_Install Package"))
328354
@@ -376,7 +402,7 @@
376 self.button_details.hide()402 self.button_details.hide()
377 else:403 else:
378 self.button_details.show()404 self.button_details.show()
379 405
380 self.label_status.set_markup(self.deps)406 self.label_status.set_markup(self.deps)
381 #img = Gtk.Image()407 #img = Gtk.Image()
382 #img.set_from_stock(Gtk.STOCK_APPLY,Gtk.IconSize.BUTTON)408 #img.set_from_stock(Gtk.STOCK_APPLY,Gtk.IconSize.BUTTON)
@@ -386,6 +412,44 @@
386 self.button_install.grab_default()412 self.button_install.grab_default()
387 self.button_remove.hide()413 self.button_remove.hide()
388414
415 def _run_lintian(self, filename):
416 buf = self.textview_lintian_output.get_buffer()
417 if not os.path.exists("/usr/bin/lintian"):
418 buf.set_text(
419 _("No lintian available.\n"
420 "Please install using sudo apt-get install lintian"))
421 return
422 buf.set_text(_("Running lintian..."))
423 self._lintian_output = ""
424 self._lintian_exit_status = None
425 cmd = ["/usr/bin/lintian", filename]
426 (pid, stdin, stdout, stderr) = GLib.spawn_async(
427 cmd, flags=GObject.SPAWN_DO_NOT_REAP_CHILD,
428 standard_output=True, standard_error=True)
429 for fd in [stdout, stderr]:
430 channel = GLib.IOChannel(filedes=fd)
431 channel.set_flags(GLib.IOFlags.NONBLOCK)
432 channel.add_watch(GLib.IOCondition.IN, self._on_lintian_output)
433 GObject.child_watch_add(
434 pid, self._on_lintian_finished)
435
436 def _on_lintian_finished(self, pid, condition):
437 exit_status = os.WEXITSTATUS(condition)
438 self._lintian_exit_status = exit_status
439 text = _("\nLintian finished with exit status %s") % exit_status
440 self._lintian_output += text
441 buf = self.textview_lintian_output.get_buffer()
442 buf.set_text(self._lintian_output)
443
444 def _on_lintian_output(self, gio_file, condition):
445 if condition & GLib.IOCondition.IN:
446 content = gio_file.read()
447 if content:
448 self._lintian_output += content
449 buf = self.textview_lintian_output.get_buffer()
450 buf.set_text(self._lintian_output)
451 return True
452
389 def on_treeview_files_cursor_changed(self, treeview):453 def on_treeview_files_cursor_changed(self, treeview):
390 " the selection in the files list chanaged "454 " the selection in the files list chanaged "
391 model = treeview.get_model()455 model = treeview.get_model()
@@ -437,9 +501,9 @@
437 # build dialog501 # build dialog
438 self.window_main.set_sensitive(False)502 self.window_main.set_sensitive(False)
439 fs = Gtk.FileChooserDialog(parent=self.window_main,503 fs = Gtk.FileChooserDialog(parent=self.window_main,
440 buttons=(Gtk.STOCK_CANCEL, 504 buttons=(Gtk.STOCK_CANCEL,
441 Gtk.ResponseType.CANCEL, 505 Gtk.ResponseType.CANCEL,
442 Gtk.STOCK_OPEN, 506 Gtk.STOCK_OPEN,
443 Gtk.ResponseType.OK),507 Gtk.ResponseType.OK),
444 action=Gtk.FileChooserAction.OPEN,508 action=Gtk.FileChooserAction.OPEN,
445 title=_("Open Software Package"))509 title=_("Open Software Package"))
@@ -466,7 +530,7 @@
466 self.window_main.set_sensitive(True)530 self.window_main.set_sensitive(True)
467531
468 def on_copy_activate(self, widget):532 def on_copy_activate(self, widget):
469 clipboard = Gtk.Clipboard.get(Gdk.atom_intern('CLIPBOARD', True)) 533 clipboard = Gtk.Clipboard.get(Gdk.atom_intern('CLIPBOARD', True))
470 buf = self.textview_description.get_buffer()534 buf = self.textview_description.get_buffer()
471 if buf.get_has_selection():535 if buf.get_has_selection():
472 buf.copy_clipboard(clipboard)536 buf.copy_clipboard(clipboard)
@@ -535,7 +599,7 @@
535 scrolled = Gtk.ScrolledWindow()599 scrolled = Gtk.ScrolledWindow()
536 textview = Gtk.TextView()600 textview = Gtk.TextView()
537 textview.set_cursor_visible(False)601 textview.set_cursor_visible(False)
538 textview.set_editable(False) 602 textview.set_editable(False)
539 buf = textview.get_buffer()603 buf = textview.get_buffer()
540 buf.set_text("\n".join(self.unauthenticated))604 buf.set_text("\n".join(self.unauthenticated))
541 scrolled.add(textview)605 scrolled.add(textview)
@@ -584,13 +648,13 @@
584 self.statusbar_main.push(self.context, msgstring)648 self.statusbar_main.push(self.context, msgstring)
585 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)649 self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)
586 return False650 return False
587 651
588 # lock for install652 # lock for install
589 self.window_main.set_sensitive(False)653 self.window_main.set_sensitive(False)
590 self.button_deb_install_close.set_sensitive(False)654 self.button_deb_install_close.set_sensitive(False)
591 # clear terminal655 # clear terminal
592 #self.vte_terminal.feed(str(0x1b)+"[2J")656 #self.vte_terminal.feed(str(0x1b)+"[2J")
593 657
594 # Get whether we auto close from synaptic's config file and658 # Get whether we auto close from synaptic's config file and
595 # update the toggle button as neccessary659 # update the toggle button as neccessary
596 config = apt_pkg.Configuration()660 config = apt_pkg.Configuration()
@@ -602,7 +666,7 @@
602 config["Synaptic::closeZvt"] = "false"666 config["Synaptic::closeZvt"] = "false"
603 self.synaptic_config = config.subtree("Synaptic")667 self.synaptic_config = config.subtree("Synaptic")
604 self.checkbutton_autoclose.set_active(self.synaptic_config.find_b("closeZvt"))668 self.checkbutton_autoclose.set_active(self.synaptic_config.find_b("closeZvt"))
605 669
606 self.dialog_deb_install.set_transient_for(self.window_main)670 self.dialog_deb_install.set_transient_for(self.window_main)
607 self.dialog_deb_install.show_all()671 self.dialog_deb_install.show_all()
608672
@@ -638,13 +702,13 @@
638 if not res:702 if not res:
639 self.show_alert(Gtk.MessageType.ERROR, header, body, msg,703 self.show_alert(Gtk.MessageType.ERROR, header, body, msg,
640 parent=self.dialog_deb_install)704 parent=self.dialog_deb_install)
641 705
642 self.label_install_status.set_markup("<span foreground=\"red\" weight=\"bold\">%s</span>" % header)706 self.label_install_status.set_markup("<span foreground=\"red\" weight=\"bold\">%s</span>" % header)
643 self.button_deb_install_close.set_sensitive(True)707 self.button_deb_install_close.set_sensitive(True)
644 self.button_deb_install_close.grab_default()708 self.button_deb_install_close.grab_default()
645 self.statusbar_main.push(self.context,_("Failed to install package file"))709 self.statusbar_main.push(self.context,_("Failed to install package file"))
646 return 710 return
647 711
648 # install the package itself712 # install the package itself
649 self.dialog_deb_install.set_title(self.window_main.get_title())713 self.dialog_deb_install.set_title(self.window_main.get_title())
650 if install:714 if install:
@@ -683,10 +747,10 @@
683 self.label_install_status.set_markup("<i>"+_("Package '%s' was removed") % os.path.basename(self._deb.pkgname)+"</i>")747 self.label_install_status.set_markup("<i>"+_("Package '%s' was removed") % os.path.basename(self._deb.pkgname)+"</i>")
684 else:748 else:
685 if install:749 if install:
686 self.label_install_status.set_markup("<b>"+_("Failed to install package '%s'") % 750 self.label_install_status.set_markup("<b>"+_("Failed to install package '%s'") %
687 os.path.basename(self._deb.filename)+"</b>")751 os.path.basename(self._deb.filename)+"</b>")
688 else:752 else:
689 self.label_install_status.set_markup("<b>"+_("Failed to remove package '%s'") % 753 self.label_install_status.set_markup("<b>"+_("Failed to remove package '%s'") %
690 os.path.basename(self._deb.pkgname)+"</b>")754 os.path.basename(self._deb.pkgname)+"</b>")
691 self.expander_install.set_expanded(True)755 self.expander_install.set_expanded(True)
692 if install:756 if install:
@@ -718,7 +782,7 @@
718782
719 def on_button_remove_clicked(self, widget):783 def on_button_remove_clicked(self, widget):
720 self.dpkg_action(widget, False)784 self.dpkg_action(widget, False)
721 785
722 def on_button_deb_install_close_clicked(self, widget):786 def on_button_deb_install_close_clicked(self, widget):
723 # Set the autoclose option when we close787 # Set the autoclose option when we close
724 autoclose = self.checkbutton_autoclose.get_active()788 autoclose = self.checkbutton_autoclose.get_active()
@@ -731,17 +795,17 @@
731 self._gio_cancellable.cancel()795 self._gio_cancellable.cancel()
732 self.dialog_deb_install.hide()796 self.dialog_deb_install.hide()
733 self.window_main.set_sensitive(True)797 self.window_main.set_sensitive(True)
734 798
735 def on_checkbutton_autoclose_clicked(self, widget):799 def on_checkbutton_autoclose_clicked(self, widget):
736 if self.action_completed:800 if self.action_completed:
737 self.on_button_deb_install_close_clicked(None) 801 self.on_button_deb_install_close_clicked(None)
738802
739 def on_window_main_delete_event(self, *args):803 def on_window_main_delete_event(self, *args):
740 if self.window_main.get_property("sensitive"):804 if self.window_main.get_property("sensitive"):
741 if Gtk.main_level() > 0:805 if Gtk.main_level() > 0:
742 Gtk.main_quit()806 Gtk.main_quit()
743 return False807 return False
744 else: 808 else:
745 return True809 return True
746810
747 def show_alert(self, type, header, body=None, details=None, parent=None):811 def show_alert(self, type, header, body=None, details=None, parent=None):
@@ -754,26 +818,26 @@
754 if not body == None:818 if not body == None:
755 message = "%s\n\n%s" % (message, body)819 message = "%s\n\n%s" % (message, body)
756 self.label_hig.set_markup(message)820 self.label_hig.set_markup(message)
757 821
758 if not details == None:822 if not details == None:
759 buffer = self.textview_hig.get_buffer()823 buffer = self.textview_hig.get_buffer()
760 buffer.set_text(str(details))824 buffer.set_text(str(details))
761 self.expander_hig.set_expanded(False)825 self.expander_hig.set_expanded(False)
762 self.expander_hig.show()826 self.expander_hig.show()
763 827
764 if type == Gtk.MessageType.ERROR:828 if type == Gtk.MessageType.ERROR:
765 self.image_hig.set_property("stock", "gtk-dialog-error")829 self.image_hig.set_property("stock", "gtk-dialog-error")
766 elif type == Gtk.MessageType.WARNING:830 elif type == Gtk.MessageType.WARNING:
767 self.image_hig.set_property("stock", "gtk-dialog-warning")831 self.image_hig.set_property("stock", "gtk-dialog-warning")
768 elif type == Gtk.MessageType.INFO:832 elif type == Gtk.MessageType.INFO:
769 self.image_hig.set_property("stock", "gtk-dialog-info")833 self.image_hig.set_property("stock", "gtk-dialog-info")
770 834
771 res = self.dialog_hig.run()835 res = self.dialog_hig.run()
772 self.dialog_hig.hide()836 self.dialog_hig.hide()
773 if res == Gtk.ResponseType.CLOSE:837 if res == Gtk.ResponseType.CLOSE:
774 return True838 return True
775 return False839 return False
776 840
777 def write_synaptic_config_file(self, config, path):841 def write_synaptic_config_file(self, config, path):
778 if not os.path.exists(path):842 if not os.path.exists(path):
779 return843 return
@@ -791,7 +855,7 @@
791855
792 def menu_action(self, widget, terminal):856 def menu_action(self, widget, terminal):
793 terminal.copy_clipboard()857 terminal.copy_clipboard()
794 858
795 # embedded classes859 # embedded classes
796 class DpkgActionProgress(object):860 class DpkgActionProgress(object):
797 def __init__(self, debfile, status, progress, term, expander, install=True):861 def __init__(self, debfile, status, progress, term, expander, install=True):
@@ -838,7 +902,7 @@
838902
839 # the command903 # the command
840 argv = ["/usr/bin/dpkg", "--auto-deconfigure"]904 argv = ["/usr/bin/dpkg", "--auto-deconfigure"]
841 # ubuntu supports VTE_PTY_KEEP_FD, see 905 # ubuntu supports VTE_PTY_KEEP_FD, see
842 # https://bugzilla.gnome.org/320128 for the upstream bug906 # https://bugzilla.gnome.org/320128 for the upstream bug
843 if UBUNTU:907 if UBUNTU:
844 argv += ["--status-fd", "%s"%writefd]908 argv += ["--status-fd", "%s"%writefd]
@@ -857,8 +921,8 @@
857 self.term.connect("child-exited", finish_dpkg, lock)921 self.term.connect("child-exited", finish_dpkg, lock)
858 (res, pid) =self.term.fork_command_full(922 (res, pid) =self.term.fork_command_full(
859 Vte.PtyFlags.DEFAULT,923 Vte.PtyFlags.DEFAULT,
860 "/", 924 "/",
861 argv, 925 argv,
862 env,926 env,
863 GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN,927 GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN,
864 # FIXME: add setup_func that closes all fds excpet for writefd928 # FIXME: add setup_func that closes all fds excpet for writefd
@@ -895,11 +959,11 @@
895 Gtk.main_iteration()959 Gtk.main_iteration()
896 time.sleep(0.2)960 time.sleep(0.2)
897 # if the terminal has not reacted for some time, do something961 # if the terminal has not reacted for some time, do something
898 if (not self.term_expander.get_expanded() and 962 if (not self.term_expander.get_expanded() and
899 (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()):963 (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()):
900 self.term_expander.set_expanded(True)964 self.term_expander.set_expanded(True)
901 self.progress.set_fraction(1.0)965 self.progress.set_fraction(1.0)
902 966
903 class InstallProgressAdapter(InstallProgress):967 class InstallProgressAdapter(InstallProgress):
904 def __init__(self,progress,term,label,term_expander):968 def __init__(self,progress,term,label,term_expander):
905 InstallProgress.__init__(self)969 InstallProgress.__init__(self)
@@ -941,7 +1005,7 @@
941 InstallProgress.update_interface(self)1005 InstallProgress.update_interface(self)
942 while Gtk.events_pending():1006 while Gtk.events_pending():
943 Gtk.main_iteration()1007 Gtk.main_iteration()
944 if (not self.term_expander.get_expanded() and 1008 if (not self.term_expander.get_expanded() and
945 (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()):1009 (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()):
946 self.term_expander.set_expanded(True)1010 self.term_expander.set_expanded(True)
947 # sleep just long enough to not create a busy loop1011 # sleep just long enough to not create a busy loop
@@ -965,7 +1029,7 @@
965 while not self.finished:1029 while not self.finished:
966 self.update_interface()1030 self.update_interface()
967 return self.apt_status1031 return self.apt_status
968 1032
969 class FetchProgressAdapter(apt.progress.base.AcquireProgress):1033 class FetchProgressAdapter(apt.progress.base.AcquireProgress):
970 def __init__(self,progress,action,main):1034 def __init__(self,progress,action,main):
971 super(GDebi.FetchProgressAdapter, self).__init__()1035 super(GDebi.FetchProgressAdapter, self).__init__()
@@ -1017,7 +1081,7 @@
1017 Gtk.main_iteration()1081 Gtk.main_iteration()
1018 def done(self):1082 def done(self):
1019 self.progressbar.hide()1083 self.progressbar.hide()
1020 1084
1021if __name__ == "__main__":1085if __name__ == "__main__":
1022 app = GDebi("data/",None)1086 app = GDebi("data/",None)
10231087
@@ -1033,16 +1097,16 @@
1033 apt_pkg.pkgsystem_lock()1097 apt_pkg.pkgsystem_lock()
1034 app.dialog_deb_install.set_transient_for(app.window_main)1098 app.dialog_deb_install.set_transient_for(app.window_main)
1035 app.dialog_deb_install.show_all()1099 app.dialog_deb_install.show_all()
1036 1100
1037 # install the dependecnies1101 # install the dependecnies
1038 fprogress = app.FetchProgressAdapter(app.progressbar_install,1102 fprogress = app.FetchProgressAdapter(app.progressbar_install,
1039 app.label_action,1103 app.label_action,
1040 app.dialog_deb_install)1104 app.dialog_deb_install)
1041 iprogress = app.InstallProgressAdapter(app.progressbar_install, 1105 iprogress = app.InstallProgressAdapter(app.progressbar_install,
1042 app.vte_terminal,1106 app.vte_terminal,
1043 app.label_action,1107 app.label_action,
1044 app.expander_install)1108 app.expander_install)
1045 res = app._cache.commit(fprogress,iprogress)1109 res = app._cache.commit(fprogress,iprogress)
1046 print "commit retured: %s" % res1110 print "commit retured: %s" % res
1047 1111
1048 Gtk.main()1112 Gtk.main()
10491113
=== modified file 'GDebi/GDebiCommon.py'
--- GDebi/GDebiCommon.py 2012-09-12 21:28:17 +0000
+++ GDebi/GDebiCommon.py 2012-10-08 06:56:32 +0000
@@ -49,6 +49,7 @@
49 return unicode(str, 'latin1')49 return unicode(str, 'latin1')
50 50
51class GDebiCommon(object):51class GDebiCommon(object):
52
52 # cprogress may be different in child classes53 # cprogress may be different in child classes
53 def __init__(self, datadir, options, file=""):54 def __init__(self, datadir, options, file=""):
54 self.cprogress = None55 self.cprogress = None
@@ -64,14 +65,14 @@
64 def openCache(self):65 def openCache(self):
65 self._cache = Cache(self.cprogress)66 self._cache = Cache(self.cprogress)
66 if self._cache._depcache.broken_count > 0:67 if self._cache._depcache.broken_count > 0:
67 self.error_header = _("Broken dependencies")68 self.error_header = _("Broken dependencies")
68 self.error_body = _("Your system has broken dependencies. "69 self.error_body = _("Your system has broken dependencies. "
69 "This application can not continue until "70 "This application can not continue until "
70 "this is fixed. "71 "this is fixed. "
71 "To fix it run 'gksudo synaptic' or "72 "To fix it run 'gksudo synaptic' or "
72 "'sudo apt-get install -f' "73 "'sudo apt-get install -f' "
73 "in a terminal window.")74 "in a terminal window.")
74 return False75 return False
75 return True76 return True
7677
77 def open(self, file, downloaded=False):78 def open(self, file, downloaded=False):
7879
=== modified file 'data/gdebi.ui'
--- data/gdebi.ui 2012-09-13 21:32:07 +0000
+++ data/gdebi.ui 2012-10-08 06:56:32 +0000
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.16"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <object class="GtkAccelGroup" id="accelgroup1"/>4 <object class="GtkAccelGroup" id="accelgroup1"/>
5 <object class="GtkAboutDialog" id="dialog_about">5 <object class="GtkAboutDialog" id="dialog_about">
6 <property name="can_focus">False</property>6 <property name="can_focus">False</property>
@@ -69,7 +69,6 @@
69 <property name="can_focus">True</property>69 <property name="can_focus">True</property>
70 <property name="can_default">True</property>70 <property name="can_default">True</property>
71 <property name="receives_default">False</property>71 <property name="receives_default">False</property>
72 <property name="use_action_appearance">False</property>
73 <property name="use_stock">True</property>72 <property name="use_stock">True</property>
74 <signal name="clicked" handler="on_button_deb_install_close_clicked" swapped="no"/>73 <signal name="clicked" handler="on_button_deb_install_close_clicked" swapped="no"/>
75 </object>74 </object>
@@ -180,8 +179,8 @@
180 <property name="visible">True</property>179 <property name="visible">True</property>
181 <property name="can_focus">True</property>180 <property name="can_focus">True</property>
182 <property name="receives_default">False</property>181 <property name="receives_default">False</property>
183 <property name="use_action_appearance">False</property>
184 <property name="use_underline">True</property>182 <property name="use_underline">True</property>
183 <property name="xalign">0.5</property>
185 <property name="draw_indicator">True</property>184 <property name="draw_indicator">True</property>
186 <signal name="clicked" handler="on_checkbutton_autoclose_clicked" swapped="no"/>185 <signal name="clicked" handler="on_checkbutton_autoclose_clicked" swapped="no"/>
187 </object>186 </object>
@@ -230,7 +229,6 @@
230 <property name="can_focus">True</property>229 <property name="can_focus">True</property>
231 <property name="can_default">True</property>230 <property name="can_default">True</property>
232 <property name="receives_default">False</property>231 <property name="receives_default">False</property>
233 <property name="use_action_appearance">False</property>
234 <property name="use_stock">True</property>232 <property name="use_stock">True</property>
235 </object>233 </object>
236 <packing>234 <packing>
@@ -328,7 +326,6 @@
328 <property name="can_focus">True</property>326 <property name="can_focus">True</property>
329 <property name="can_default">True</property>327 <property name="can_default">True</property>
330 <property name="receives_default">True</property>328 <property name="receives_default">True</property>
331 <property name="use_action_appearance">False</property>
332 <property name="use_stock">True</property>329 <property name="use_stock">True</property>
333 </object>330 </object>
334 <packing>331 <packing>
@@ -439,7 +436,6 @@
439 <property name="can_focus">True</property>436 <property name="can_focus">True</property>
440 <property name="can_default">True</property>437 <property name="can_default">True</property>
441 <property name="receives_default">False</property>438 <property name="receives_default">False</property>
442 <property name="use_action_appearance">False</property>
443 <property name="use_stock">True</property>439 <property name="use_stock">True</property>
444 </object>440 </object>
445 <packing>441 <packing>
@@ -589,7 +585,6 @@
589 <object class="GtkMenuItem" id="menuitem1">585 <object class="GtkMenuItem" id="menuitem1">
590 <property name="visible">True</property>586 <property name="visible">True</property>
591 <property name="can_focus">False</property>587 <property name="can_focus">False</property>
592 <property name="use_action_appearance">False</property>
593 <property name="label" translatable="yes">_File</property>588 <property name="label" translatable="yes">_File</property>
594 <property name="use_underline">True</property>589 <property name="use_underline">True</property>
595 <child type="submenu">590 <child type="submenu">
@@ -600,7 +595,6 @@
600 <property name="label" translatable="yes">_Open…</property>595 <property name="label" translatable="yes">_Open…</property>
601 <property name="visible">True</property>596 <property name="visible">True</property>
602 <property name="can_focus">False</property>597 <property name="can_focus">False</property>
603 <property name="use_action_appearance">False</property>
604 <property name="use_underline">True</property>598 <property name="use_underline">True</property>
605 <property name="image">image1</property>599 <property name="image">image1</property>
606 <property name="use_stock">False</property>600 <property name="use_stock">False</property>
@@ -614,7 +608,6 @@
614 <property name="label" translatable="yes">_Refresh</property>608 <property name="label" translatable="yes">_Refresh</property>
615 <property name="visible">True</property>609 <property name="visible">True</property>
616 <property name="can_focus">False</property>610 <property name="can_focus">False</property>
617 <property name="use_action_appearance">False</property>
618 <property name="use_underline">True</property>611 <property name="use_underline">True</property>
619 <property name="image">image2</property>612 <property name="image">image2</property>
620 <property name="use_stock">False</property>613 <property name="use_stock">False</property>
@@ -634,7 +627,6 @@
634 <property name="label">gtk-quit</property>627 <property name="label">gtk-quit</property>
635 <property name="visible">True</property>628 <property name="visible">True</property>
636 <property name="can_focus">False</property>629 <property name="can_focus">False</property>
637 <property name="use_action_appearance">False</property>
638 <property name="use_underline">True</property>630 <property name="use_underline">True</property>
639 <property name="use_stock">True</property>631 <property name="use_stock">True</property>
640 <property name="accel_group">accelgroup1</property>632 <property name="accel_group">accelgroup1</property>
@@ -649,7 +641,6 @@
649 <object class="GtkMenuItem" id="menuitem3">641 <object class="GtkMenuItem" id="menuitem3">
650 <property name="visible">True</property>642 <property name="visible">True</property>
651 <property name="can_focus">False</property>643 <property name="can_focus">False</property>
652 <property name="use_action_appearance">False</property>
653 <property name="label" translatable="yes">_Edit</property>644 <property name="label" translatable="yes">_Edit</property>
654 <property name="use_underline">True</property>645 <property name="use_underline">True</property>
655 <child type="submenu">646 <child type="submenu">
@@ -660,7 +651,6 @@
660 <property name="label">gtk-copy</property>651 <property name="label">gtk-copy</property>
661 <property name="visible">True</property>652 <property name="visible">True</property>
662 <property name="can_focus">False</property>653 <property name="can_focus">False</property>
663 <property name="use_action_appearance">False</property>
664 <property name="use_underline">True</property>654 <property name="use_underline">True</property>
665 <property name="use_stock">True</property>655 <property name="use_stock">True</property>
666 <property name="accel_group">accelgroup1</property>656 <property name="accel_group">accelgroup1</property>
@@ -675,7 +665,6 @@
675 <object class="GtkMenuItem" id="menuitem4">665 <object class="GtkMenuItem" id="menuitem4">
676 <property name="visible">True</property>666 <property name="visible">True</property>
677 <property name="can_focus">False</property>667 <property name="can_focus">False</property>
678 <property name="use_action_appearance">False</property>
679 <property name="label" translatable="yes">_Help</property>668 <property name="label" translatable="yes">_Help</property>
680 <property name="use_underline">True</property>669 <property name="use_underline">True</property>
681 <child type="submenu">670 <child type="submenu">
@@ -686,7 +675,6 @@
686 <property name="label">gtk-about</property>675 <property name="label">gtk-about</property>
687 <property name="visible">True</property>676 <property name="visible">True</property>
688 <property name="can_focus">False</property>677 <property name="can_focus">False</property>
689 <property name="use_action_appearance">False</property>
690 <property name="use_underline">True</property>678 <property name="use_underline">True</property>
691 <property name="use_stock">True</property>679 <property name="use_stock">True</property>
692 <property name="accel_group">accelgroup1</property>680 <property name="accel_group">accelgroup1</property>
@@ -727,7 +715,7 @@
727 </object>715 </object>
728 <packing>716 <packing>
729 <property name="x_options">GTK_FILL</property>717 <property name="x_options">GTK_FILL</property>
730 <property name="y_options"></property>718 <property name="y_options"/>
731 </packing>719 </packing>
732 </child>720 </child>
733 <child>721 <child>
@@ -737,14 +725,12 @@
737 <property name="xalign">0</property>725 <property name="xalign">0</property>
738 <property name="label" translatable="yes">&lt;b&gt;&lt;big&gt; &lt;/big&gt;&lt;/b&gt;</property>726 <property name="label" translatable="yes">&lt;b&gt;&lt;big&gt; &lt;/big&gt;&lt;/b&gt;</property>
739 <property name="use_markup">True</property>727 <property name="use_markup">True</property>
740 <property name="selectable">False</property>
741 <property name="sensitive">True</property>
742 </object>728 </object>
743 <packing>729 <packing>
744 <property name="left_attach">1</property>730 <property name="left_attach">1</property>
745 <property name="right_attach">2</property>731 <property name="right_attach">2</property>
746 <property name="x_options">GTK_FILL</property>732 <property name="x_options">GTK_FILL</property>
747 <property name="y_options"></property>733 <property name="y_options"/>
748 </packing>734 </packing>
749 </child>735 </child>
750 <child>736 <child>
@@ -758,8 +744,6 @@
758 <property name="xalign">0</property>744 <property name="xalign">0</property>
759 <property name="yalign">0</property>745 <property name="yalign">0</property>
760 <property name="wrap">True</property>746 <property name="wrap">True</property>
761 <property name="selectable">False</property>
762 <property name="sensitive">True</property>
763 </object>747 </object>
764 <packing>748 <packing>
765 <property name="expand">True</property>749 <property name="expand">True</property>
@@ -777,7 +761,6 @@
777 <property name="label" translatable="yes">_Details</property>761 <property name="label" translatable="yes">_Details</property>
778 <property name="can_focus">True</property>762 <property name="can_focus">True</property>
779 <property name="receives_default">True</property>763 <property name="receives_default">True</property>
780 <property name="use_action_appearance">False</property>
781 <property name="use_underline">True</property>764 <property name="use_underline">True</property>
782 <signal name="clicked" handler="on_button_details_clicked" swapped="no"/>765 <signal name="clicked" handler="on_button_details_clicked" swapped="no"/>
783 </object>766 </object>
@@ -804,7 +787,7 @@
804 <property name="top_attach">2</property>787 <property name="top_attach">2</property>
805 <property name="bottom_attach">3</property>788 <property name="bottom_attach">3</property>
806 <property name="x_options">GTK_FILL</property>789 <property name="x_options">GTK_FILL</property>
807 <property name="y_options"></property>790 <property name="y_options"/>
808 </packing>791 </packing>
809 </child>792 </child>
810 <child>793 <child>
@@ -832,7 +815,7 @@
832 <property name="top_attach">1</property>815 <property name="top_attach">1</property>
833 <property name="bottom_attach">2</property>816 <property name="bottom_attach">2</property>
834 <property name="x_options">GTK_FILL</property>817 <property name="x_options">GTK_FILL</property>
835 <property name="y_options"></property>818 <property name="y_options"/>
836 </packing>819 </packing>
837 </child>820 </child>
838 <child>821 <child>
@@ -846,7 +829,7 @@
846 <property name="right_attach">2</property>829 <property name="right_attach">2</property>
847 <property name="top_attach">1</property>830 <property name="top_attach">1</property>
848 <property name="bottom_attach">2</property>831 <property name="bottom_attach">2</property>
849 <property name="y_options"></property>832 <property name="y_options"/>
850 </packing>833 </packing>
851 </child>834 </child>
852 </object>835 </object>
@@ -869,7 +852,6 @@
869 <property name="can_focus">True</property>852 <property name="can_focus">True</property>
870 <property name="can_default">True</property>853 <property name="can_default">True</property>
871 <property name="receives_default">False</property>854 <property name="receives_default">False</property>
872 <property name="use_action_appearance">False</property>
873 <property name="use_underline">True</property>855 <property name="use_underline">True</property>
874 <signal name="clicked" handler="on_button_install_clicked" swapped="no"/>856 <signal name="clicked" handler="on_button_install_clicked" swapped="no"/>
875 </object>857 </object>
@@ -880,13 +862,28 @@
880 </packing>862 </packing>
881 </child>863 </child>
882 <child>864 <child>
865 <object class="GtkButton" id="button_remove">
866 <property name="label" translatable="yes">_Remove Package</property>
867 <property name="sensitive">False</property>
868 <property name="can_focus">True</property>
869 <property name="can_default">True</property>
870 <property name="receives_default">False</property>
871 <property name="use_underline">True</property>
872 <signal name="clicked" handler="on_button_remove_clicked" swapped="no"/>
873 </object>
874 <packing>
875 <property name="expand">False</property>
876 <property name="fill">False</property>
877 <property name="position">1</property>
878 </packing>
879 </child>
880 <child>
883 <object class="GtkButton" id="button_download">881 <object class="GtkButton" id="button_download">
884 <property name="label" translatable="yes">_Download Package</property>882 <property name="label" translatable="yes">_Download Package</property>
885 <property name="sensitive">False</property>883 <property name="sensitive">False</property>
886 <property name="can_focus">True</property>884 <property name="can_focus">True</property>
887 <property name="can_default">True</property>885 <property name="can_default">True</property>
888 <property name="receives_default">False</property>886 <property name="receives_default">False</property>
889 <property name="use_action_appearance">False</property>
890 <property name="use_underline">True</property>887 <property name="use_underline">True</property>
891 <signal name="clicked" handler="on_button_download_clicked" swapped="no"/>888 <signal name="clicked" handler="on_button_download_clicked" swapped="no"/>
892 </object>889 </object>
@@ -897,24 +894,6 @@
897 </packing>894 </packing>
898 </child>895 </child>
899 <child>896 <child>
900 <object class="GtkButton" id="button_remove">
901 <property name="label" translatable="yes">_Remove Package</property>
902 <property name="visible">False</property>
903 <property name="sensitive">False</property>
904 <property name="can_focus">True</property>
905 <property name="can_default">True</property>
906 <property name="receives_default">False</property>
907 <property name="use_action_appearance">False</property>
908 <property name="use_underline">True</property>
909 <signal name="clicked" handler="on_button_remove_clicked" swapped="no"/>
910 </object>
911 <packing>
912 <property name="expand">False</property>
913 <property name="fill">False</property>
914 <property name="position">1</property>
915 </packing>
916 </child>
917 <child>
918 <placeholder/>897 <placeholder/>
919 </child>898 </child>
920 </object>899 </object>
@@ -987,7 +966,7 @@
987 </object>966 </object>
988 <packing>967 <packing>
989 <property name="x_options">GTK_FILL</property>968 <property name="x_options">GTK_FILL</property>
990 <property name="y_options"></property>969 <property name="y_options"/>
991 </packing>970 </packing>
992 </child>971 </child>
993 <child>972 <child>
@@ -1002,7 +981,7 @@
1002 <property name="top_attach">1</property>981 <property name="top_attach">1</property>
1003 <property name="bottom_attach">2</property>982 <property name="bottom_attach">2</property>
1004 <property name="x_options">GTK_FILL</property>983 <property name="x_options">GTK_FILL</property>
1005 <property name="y_options"></property>984 <property name="y_options"/>
1006 </packing>985 </packing>
1007 </child>986 </child>
1008 <child>987 <child>
@@ -1017,7 +996,7 @@
1017 <property name="top_attach">2</property>996 <property name="top_attach">2</property>
1018 <property name="bottom_attach">3</property>997 <property name="bottom_attach">3</property>
1019 <property name="x_options">GTK_FILL</property>998 <property name="x_options">GTK_FILL</property>
1020 <property name="y_options"></property>999 <property name="y_options"/>
1021 </packing>1000 </packing>
1022 </child>1001 </child>
1023 <child>1002 <child>
@@ -1032,7 +1011,7 @@
1032 <property name="top_attach">3</property>1011 <property name="top_attach">3</property>
1033 <property name="bottom_attach">4</property>1012 <property name="bottom_attach">4</property>
1034 <property name="x_options">GTK_FILL</property>1013 <property name="x_options">GTK_FILL</property>
1035 <property name="y_options"></property>1014 <property name="y_options"/>
1036 </packing>1015 </packing>
1037 </child>1016 </child>
1038 <child>1017 <child>
@@ -1047,7 +1026,7 @@
1047 <property name="top_attach">4</property>1026 <property name="top_attach">4</property>
1048 <property name="bottom_attach">5</property>1027 <property name="bottom_attach">5</property>
1049 <property name="x_options">GTK_FILL</property>1028 <property name="x_options">GTK_FILL</property>
1050 <property name="y_options"></property>1029 <property name="y_options"/>
1051 </packing>1030 </packing>
1052 </child>1031 </child>
1053 <child>1032 <child>
@@ -1063,7 +1042,7 @@
1063 <property name="top_attach">1</property>1042 <property name="top_attach">1</property>
1064 <property name="bottom_attach">2</property>1043 <property name="bottom_attach">2</property>
1065 <property name="x_options">GTK_FILL</property>1044 <property name="x_options">GTK_FILL</property>
1066 <property name="y_options"></property>1045 <property name="y_options"/>
1067 </packing>1046 </packing>
1068 </child>1047 </child>
1069 <child>1048 <child>
@@ -1079,7 +1058,7 @@
1079 <property name="top_attach">2</property>1058 <property name="top_attach">2</property>
1080 <property name="bottom_attach">3</property>1059 <property name="bottom_attach">3</property>
1081 <property name="x_options">GTK_FILL</property>1060 <property name="x_options">GTK_FILL</property>
1082 <property name="y_options"></property>1061 <property name="y_options"/>
1083 </packing>1062 </packing>
1084 </child>1063 </child>
1085 <child>1064 <child>
@@ -1095,7 +1074,7 @@
1095 <property name="top_attach">3</property>1074 <property name="top_attach">3</property>
1096 <property name="bottom_attach">4</property>1075 <property name="bottom_attach">4</property>
1097 <property name="x_options">GTK_FILL</property>1076 <property name="x_options">GTK_FILL</property>
1098 <property name="y_options"></property>1077 <property name="y_options"/>
1099 </packing>1078 </packing>
1100 </child>1079 </child>
1101 <child>1080 <child>
@@ -1109,7 +1088,7 @@
1109 <property name="left_attach">1</property>1088 <property name="left_attach">1</property>
1110 <property name="right_attach">2</property>1089 <property name="right_attach">2</property>
1111 <property name="x_options">GTK_FILL</property>1090 <property name="x_options">GTK_FILL</property>
1112 <property name="y_options"></property>1091 <property name="y_options"/>
1113 </packing>1092 </packing>
1114 </child>1093 </child>
1115 <child>1094 <child>
@@ -1124,7 +1103,7 @@
1124 <property name="right_attach">2</property>1103 <property name="right_attach">2</property>
1125 <property name="top_attach">4</property>1104 <property name="top_attach">4</property>
1126 <property name="bottom_attach">5</property>1105 <property name="bottom_attach">5</property>
1127 <property name="y_options"></property>1106 <property name="y_options"/>
1128 </packing>1107 </packing>
1129 </child>1108 </child>
1130 </object>1109 </object>
@@ -1216,6 +1195,34 @@
1216 <property name="tab_fill">False</property>1195 <property name="tab_fill">False</property>
1217 </packing>1196 </packing>
1218 </child>1197 </child>
1198 <child>
1199 <object class="GtkScrolledWindow" id="scrolledwindow3">
1200 <property name="visible">True</property>
1201 <property name="can_focus">True</property>
1202 <property name="shadow_type">in</property>
1203 <child>
1204 <object class="GtkTextView" id="textview_lintian_output">
1205 <property name="visible">True</property>
1206 <property name="can_focus">True</property>
1207 <property name="editable">False</property>
1208 </object>
1209 </child>
1210 </object>
1211 <packing>
1212 <property name="position">3</property>
1213 </packing>
1214 </child>
1215 <child type="tab">
1216 <object class="GtkLabel" id="label_lintian">
1217 <property name="visible">True</property>
1218 <property name="can_focus">False</property>
1219 <property name="label" translatable="yes">Lintian output</property>
1220 </object>
1221 <packing>
1222 <property name="position">3</property>
1223 <property name="tab_fill">False</property>
1224 </packing>
1225 </child>
1219 </object>1226 </object>
1220 <packing>1227 <packing>
1221 <property name="expand">True</property>1228 <property name="expand">True</property>
12221229
=== added file 'tests/test_gdebi_gtk_lintian.py'
--- tests/test_gdebi_gtk_lintian.py 1970-01-01 00:00:00 +0000
+++ tests/test_gdebi_gtk_lintian.py 2012-10-08 06:56:32 +0000
@@ -0,0 +1,63 @@
1#!/usr/bin/python
2
3import os
4import time
5import unittest
6
7from gi.repository import GObject
8from mock import patch
9
10from GDebi.GDebi import GDebi
11from GDebi.GDebiCommon import GDebiCommon
12
13EXPECTED_LINTIAN_OUTPUT = """E: error-package: file-in-etc-not-marked-as-conffile etc/foo
14E: error-package: control-file-has-bad-owner postinst egon/egon != root/root
15E: error-package: no-copyright-file
16E: error-package: package-has-no-description
17E: error-package: no-maintainer-field
18W: error-package: no-section-field
19W: error-package: no-priority-field
20E: error-package: wrong-file-owner-uid-or-gid etc/ 1000/1000
21E: error-package: wrong-file-owner-uid-or-gid etc/foo 1000/1000
22W: error-package: maintainer-script-ignores-errors postinst
23
24Lintian finished with exit status 1"""
25
26
27def do_events():
28 context = GObject.main_context_default()
29 while context.pending():
30 context.iteration()
31
32
33class GDebiGtkTestCase(unittest.TestCase):
34
35 def setUp(self):
36 self.testsdir = os.path.dirname(__file__)
37 self.datadir = os.path.join(self.testsdir, "..", "data")
38 self.options = None
39
40 # we don't need a cache for this test so patch it out
41 @patch.object(GDebiCommon, "openCache")
42 def test_lintian(self, mock_open_cache):
43 gdebi = GDebi(self.datadir, self.options)
44 gdebi._run_lintian(
45 os.path.join(self.testsdir, "error-package_1.0_all.deb"))
46 # wait for lintian to finish
47 for i in range(25):
48 time.sleep(0.2)
49 do_events()
50 if gdebi._lintian_exit_status is not None:
51 break
52 else:
53 self.fail("lintian did not finish")
54 # compare the results
55 buf = gdebi.textview_lintian_output.get_buffer()
56 start = buf.get_start_iter()
57 end = buf.get_end_iter()
58 lintian_output = buf.get_text(start, end, False)
59 self.assertEqual(lintian_output.strip(), EXPECTED_LINTIAN_OUTPUT)
60
61
62if __name__ == "__main__":
63 unittest.main()

Subscribers

People subscribed via source and target branches

to status/vote changes: