def generate_file(fname, ns_func, dest_dir='.'):
 with open(pjoin(root, 'buildutils', 'templates', ('%s' % fname)), 'r') as f:
  tpl = f.read()
 out = tpl.format(**ns_func())
 dest = pjoin(dest_dir, fname)
 info(('generating %s from template' % dest))
 with open(dest, 'w') as f:
  f.write(out)

def generate_file ( fname , ns_func , dest_dir = '.' ) : with open ( pjoin ( root , 'buildutils' , 'templates' , ( '%s' % fname ) ) , 'r' ) as f : tpl = f . read ( ) out = tpl . format ( ** ns_func ( ) ) dest = pjoin ( dest_dir , fname ) info ( ( 'generating %s from template' % dest ) ) with open ( dest , 'w' ) as f : f . write ( out )
generate a constants file from its template .