CMS 3D CMS Logo

Classes | Functions
main Namespace Reference

Classes

class  SkeletonOptionParser
 

Functions

def generator ()
 
def parse_args (args)
 
def tmpl_dir ()
 

Function Documentation

def main.generator ( )
Code generator function, parse user arguments and load appropriate
template module. Once loaded, run its data method depending on
user requested input parameter, e.g. print_etags, print_tags or
generate template code.

Definition at line 82 of file main.py.

References utils.code_generator(), parse_args(), edm.print(), and utils.test_env().

82 def generator():
83  """
84  Code generator function, parse user arguments and load appropriate
85  template module. Once loaded, run its data method depending on
86  user requested input parameter, e.g. print_etags, print_tags or
87  generate template code.
88  """
89  optmgr = SkeletonOptionParser()
90  opts, args = optmgr.get_opt()
91  test_env(os.path.join(opts.tdir, opts.tmpl), opts.tmpl)
92  config = {'pname': opts.pname, 'tmpl': opts.tmpl, 'author': opts.author,
93  'args': parse_args(args), 'debug': opts.debug,
94  'ftype': opts.ftype, 'tmpl_dir': opts.tdir}
95  if opts.ketags:
96  etags = opts.ketags.split(',')
97  config.update({'tmpl_etags': etags})
98  else:
99  config.update({'tmpl_etags': []})
100  obj = code_generator(config)
101  if opts.etags:
102  obj.print_etags()
103  sys.exit(0)
104  elif opts.tags:
105  obj.print_tags()
106  sys.exit(0)
107  elif opts.templates:
108  for name in os.listdir(opts.tdir):
109  print(name)
110  sys.exit(0)
111  obj.generate()
112 
def generator()
Definition: main.py:82
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def parse_args(args)
Definition: main.py:70
def test_env(tdir, tmpl)
Definition: utils.py:38
def code_generator(kwds)
Definition: utils.py:107
def main.parse_args (   args)

Definition at line 70 of file main.py.

Referenced by generator().

70 def parse_args(args):
71  "Parse input arguments"
72  output = {}
73  for arg in args:
74  key, val = arg.split('=')
75  key = key.strip()
76  val = val.strip()
77  if val[0] == '[' and val[-1] == ']':
78  val = eval(val, { "__builtins__": None }, {})
79  output[key] = val
80  return output
81 
def parse_args(args)
Definition: main.py:70
def main.tmpl_dir ( )

Definition at line 23 of file main.py.

References join().

23 def tmpl_dir():
24  "Retturn default location of template directory"
25  return '%s/templates' % '/'.join(__file__.split('/')[:-1])
26 
def tmpl_dir()
Definition: main.py:23
static std::string join(char **cmd)
Definition: RemoteFile.cc:18