appcon.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 """
00004 usage: %(progname)s 
00005    install [taskid]
00006    remove [taskid]
00007    list
00008 """
00009 
00010 
00011 import os, sys, string, time, getopt
00012 
00013 PKG = 'webui' # this package name
00014 import roslib; roslib.load_manifest(PKG) 
00015 
00016 from webui import webutil
00017 
00018 import roslib.scriptutil
00019 
00020 from pyclearsilver.log import *
00021 
00022 import db_webui
00023 
00024 def test():
00025   pass
00026 
00027 def usage(progname):
00028   print __doc__ % vars()
00029 
00030 def main(argv, stdout, environ):
00031   progname = argv[0]
00032   optlist, args = getopt.getopt(argv[1:], "", ["help", "test", "debug"])
00033 
00034   testflag = 0
00035   if len(args) == 0:
00036     usage(progname)
00037     return
00038   for (field, val) in optlist:
00039     if field == "--help":
00040       usage(progname)
00041       return
00042     elif field == "--debug":
00043       debugfull()
00044     elif field == "--test":
00045       testflag = 1
00046 
00047   if testflag:
00048     test()
00049     return
00050 
00051   db = db_webui.initSchema()
00052 
00053   cmd = args[0]
00054   args = args[1:]
00055 
00056   if cmd == "list":
00057     apps = db.apps.listApps()
00058     for app in apps:
00059       print app.taskid
00060   elif cmd == "install":
00061     for taskid in args:
00062       db.apps.installAppWithPath(taskid)
00063   elif cmd == "remove":
00064     for taskid in args:
00065       db.apps.removeApp(taskid)
00066   elif cmd == "listall":
00067     apps = webutil.list_apps()
00068     for app in apps:
00069       print app
00070 
00071 if __name__ == "__main__":
00072   main(sys.argv, sys.stdout, os.environ)


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Sat Dec 28 2013 17:47:58