new_module.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import os
4 
5 tplDir = os.environ['SRT_PRIVATE_CONTEXT']+'/Demo/templates/'
6 if not os.path.isdir(tplDir):
7  tplDir = os.environ['SRT_PUBLIC_CONTEXT']+'/Demo/templates/'
8 
9 if not os.path.isdir(tplDir):
10  print 'Unable to find templates.'
11  exit(1)
12 
13 module = raw_input('Module name? ')
14 namespace = raw_input('Namespace? ')
15 
16 reps = {}
17 reps['MODULENAME'] = module
18 reps['NAMESPACE'] = namespace
19 reps['FCLNAME'] = module.lower()
20 reps['AUTHOR'] = os.environ['USER']
21 reps['INCLUDEGUARD'] = namespace.upper()+'_'+module.upper()+'_H'
22 
23 for ext in ['.cxx', '.h', '.fcl', '_module.cc']:
24  fin = open(tplDir+'Template'+ext)
25  fout = open(module+ext, 'w')
26 
27  for line in fin:
28  for key, val in reps.items():
29  line = line.replace(key, val)
30  fout.write(line)
31 
32  print 'Created', fout.name
procfile open("FD_BRL_v0.txt")
exit(0)