home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / system-config-printer / gpk-install-package-name < prev    next >
Encoding:
Text File  |  2010-09-28  |  1.6 KB  |  50 lines

  1. #!/usr/bin/python -u
  2. # vim: set fileencoding=utf-8 :
  3. #
  4. # (C) 2010 Guido Guenther <agx@sigxcpu.org>
  5. #    This program is free software; you can redistribute it and/or modify
  6. #    it under the terms of the GNU General Public License as published by
  7. #    the Free Software Foundation; either version 2 of the License, or
  8. #    (at your option) any later version.
  9. #
  10. #    This program is distributed in the hope that it will be useful,
  11. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #    GNU General Public License for more details.
  14. #
  15. #    You should have received a copy of the GNU General Public License
  16. #    along with this program; if not, write to the Free Software
  17. #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. #
  19. """Emulate gpk-install-package-name"""
  20.  
  21. import sys
  22. import dbus
  23.  
  24. def main(argv):
  25.     pkgs = argv[1:]
  26.     if not pkgs:
  27.         print >>sys.stderr, "no packages given"
  28.         return 1
  29.  
  30.     bus = dbus.SessionBus()
  31.     pk = bus.get_object('org.freedesktop.PackageKit',
  32.                         '/org/freedesktop/PackageKit');
  33.  
  34.     pk_iface = dbus.Interface(pk, dbus_interface='org.freedesktop.PackageKit.Modify')
  35.  
  36.     try:
  37.         ret = pk_iface.InstallPackageNames(0, pkgs, "hide-finished,hide-warnings", timeout=300000)
  38.         if ret:
  39.             print >>sys.stderr, "Error installing packages"
  40.             return 1
  41.     except dbus.exceptions.DBusException, cause:
  42.         print sys.stderr, cause
  43.         return 1
  44.     return 0
  45.  
  46. if __name__ == '__main__':
  47.     sys.exit(main(sys.argv))
  48.  
  49. # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:┬╗┬╖,trail\:┬╖:
  50.