+
+ def ds_by_detail(od,os,detail_level,op):
+ global debug_set
+ debug_set = set([df for df in DBG.iterconstants() if df <= detail_level])
+
+ def ds_one(mutator,df, od,os,value,op):
+ mutator(df)
+
+ optparser.add_option('-D', '--debug',
+ default=debug_def_detail.name,
+ type='choice',
+ choices=[dl.name for dl in DBG.iterconstants()],
+ action='callback',
+ callback= ds_by_detail)
+
+ optparser.add_option('--no-debug',
+ nargs=0,
+ action='callback',
+ callback= partial(ds_by_detail,DBG.INIT))
+
+ for df in DBG.iterconstants():
+ optparser.add_option('--debug-'+df.name,
+ action='callback',
+ callback= partial(ds_one, debug_set.add, df))
+ optparser.add_option('--no-debug-'+df.name,
+ action='callback',
+ callback= partial(ds_one, debug_set.discard, df))
+