Back to index

system-config-printer  1.3.9+20120706
installpackage.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 
00003 ## system-config-printer
00004 
00005 ## Copyright (C) 2008, 2009 Red Hat, Inc.
00006 ## Copyright (C) 2008, 2009 Tim Waugh <twaugh@redhat.com>
00007 
00008 ## This program is free software; you can redistribute it and/or modify
00009 ## it under the terms of the GNU General Public License as published by
00010 ## the Free Software Foundation; either version 2 of the License, or
00011 ## (at your option) any later version.
00012 
00013 ## This program is distributed in the hope that it will be useful,
00014 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 ## GNU General Public License for more details.
00017 
00018 ## You should have received a copy of the GNU General Public License
00019 ## along with this program; if not, write to the Free Software
00020 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 
00022 import os
00023 import glib
00024 
00025 class PackageKit:
00026     def __init__ (self):
00027         for dir in os.environ.get ("PATH", "").split (":"):
00028             path = dir + os.path.sep + "gpk-install-package-name"
00029             if os.access (path, os.X_OK):
00030                 self.gpk_install_package_name = path
00031                 return
00032 
00033         raise RuntimeError, "No gpk-install-package-name program available"
00034 
00035     def InstallPackageName (self, xid, timestamp, name):
00036         glib.spawn_async ([self.gpk_install_package_name, name])