packagekit/data/tests/pk-spawn-dispatcher.py.in
Anders F Bjorklund b168bd6d3d Generate the python files to get the path right
Apparently it doesn't work with /usr/bin/env and spawning (?),
so make sure to get the absolute path of python in the shebang.

Make sure to make generated scripts executable and distcleaned.
2013-06-16 20:30:22 +02:00

44 lines
1.4 KiB
Python
Executable File

#!@PYTHON@
#
# 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
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Copyright (C) 2008 Tim Lauridsen <timlau@fedoraproject.org>
# Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
# Dispacher script to run pk commands from stdin
import sys
import time
from packagekit.backend import *
class PackageKitYumBackend(PackageKitBaseBackend):
def __init__(self,args,lock=True):
PackageKitBaseBackend.__init__(self,args)
PackageKitBaseBackend.doLock(self)
# simulate doing something
time.sleep(2)
def unLock(self):
PackageKitBaseBackend.unLock(self)
# simulate doing something
time.sleep(0.5)
def search_name(self,filters,key):
# check we escape spaces properly
if key == ['power manager']:
self.package("polkit;0.0.1;i386;data",INFO_AVAILABLE,"PolicyKit daemon")
def main():
backend = PackageKitYumBackend('',lock=True)
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
main()