2013-05-09 12:33:51 -07:00
|
|
|
#!@PYTHON@
|
2008-09-05 07:24:38 -07:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2010-01-27 08:32:11 -08:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-09-05 07:24:38 -07:00
|
|
|
|
|
|
|
# Copyright (C) 2008 Tim Lauridsen <timlau@fedoraproject.org>
|
2008-09-17 02:49:13 -07:00
|
|
|
# Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
|
2008-09-05 07:24:38 -07:00
|
|
|
|
|
|
|
# Dispacher script to run pk commands from stdin
|
|
|
|
|
|
|
|
import sys
|
2008-10-03 02:28:34 -07:00
|
|
|
import time
|
2008-09-17 02:49:13 -07:00
|
|
|
from packagekit.backend import *
|
2008-09-05 07:24:38 -07:00
|
|
|
|
2008-09-17 02:49:13 -07:00
|
|
|
class PackageKitYumBackend(PackageKitBaseBackend):
|
|
|
|
def __init__(self,args,lock=True):
|
|
|
|
PackageKitBaseBackend.__init__(self,args)
|
2008-10-03 02:28:34 -07:00
|
|
|
PackageKitBaseBackend.doLock(self)
|
|
|
|
# simulate doing something
|
|
|
|
time.sleep(2)
|
|
|
|
|
|
|
|
def unLock(self):
|
|
|
|
PackageKitBaseBackend.unLock(self)
|
|
|
|
# simulate doing something
|
2008-10-03 03:13:36 -07:00
|
|
|
time.sleep(0.5)
|
2008-09-17 02:49:13 -07:00
|
|
|
|
|
|
|
def search_name(self,filters,key):
|
2008-09-17 02:24:33 -07:00
|
|
|
# check we escape spaces properly
|
2010-06-29 03:27:27 -07:00
|
|
|
if key == ['power manager']:
|
2008-09-17 02:49:13 -07:00
|
|
|
self.package("polkit;0.0.1;i386;data",INFO_AVAILABLE,"PolicyKit daemon")
|
2008-09-05 08:49:19 -07:00
|
|
|
|
|
|
|
def main():
|
2008-09-17 02:49:13 -07:00
|
|
|
backend = PackageKitYumBackend('',lock=True)
|
|
|
|
backend.dispatcher(sys.argv[1:])
|
2008-09-05 08:49:19 -07:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|