-# utility methods here
-def optparse_listvalue_callback(option, option_string, value, parser):
- setattr(parser.values, option.dest, value.split(','))
-
-# a code fragment that could be helpful for argparse which unfortunately is
-# available with 2.7 only, so this feels like too strong a requirement for the client side
-#class ExtraArgAction (argparse.Action):
-# def __call__ (self, parser, namespace, values, option_string=None):
-# would need a try/except of course
-# (k,v)=values.split('=')
-# d=getattr(namespace,self.dest)
-# d[k]=v
-#####
-#parser.add_argument ("-X","--extra",dest='extras', default={}, action=ExtraArgAction,
-# help="set extra flags, testbed dependent, e.g. --extra enabled=true")
-
-def optparse_dictvalue_callback (option, option_string, value, parser):
- try:
- (k,v)=value.split('=',1)
- d=getattr(parser.values, option.dest)
- d[k]=v
- except:
- parser.print_help()
- sys.exit(1)