def render_and_create_dir(dirname, context, output_dir, environment, overwrite_if_exists=False):
 name_tmpl = environment.from_string(dirname)
 rendered_dirname = name_tmpl.render(**context)
 dir_to_create = os.path.normpath(os.path.join(output_dir, rendered_dirname))
 logger.debug(u'Rendered dir {} must exist in output_dir {}'.format(dir_to_create, output_dir))
 output_dir_exists = os.path.exists(dir_to_create)
 if overwrite_if_exists:
  if output_dir_exists:
   logger.debug(u'Output directory {} already exists,overwriting it'.format(dir_to_create))
 elif output_dir_exists:
  msg = u'Error: "{}" directory already exists'.format(dir_to_create)
  raise OutputDirExistsException(msg)
 make_sure_path_exists(dir_to_create)
 return dir_to_create

def render_and_create_dir ( dirname , context , output_dir , environment , overwrite_if_exists = False ) : name_tmpl = environment . from_string ( dirname ) rendered_dirname = name_tmpl . render ( ** context ) dir_to_create = os . path . normpath ( os . path . join ( output_dir , rendered_dirname ) ) logger . debug ( u'Rendered dir {} must exist in output_dir {}' . format ( dir_to_create , output_dir ) ) output_dir_exists = os . path . exists ( dir_to_create ) if overwrite_if_exists : if output_dir_exists : logger . debug ( u'Output directory {} already exists,overwriting it' . format ( dir_to_create ) ) elif output_dir_exists : msg = u'Error: "{}" directory already exists' . format ( dir_to_create ) raise OutputDirExistsException ( msg ) make_sure_path_exists ( dir_to_create ) return dir_to_create
render name of a directory .