def save_new_environment(name, datadir, srcdir, ckan_version,<EOL>deploy_target=None, always_prod=False):
with open(datadir + '<STR_LIT>', '<STR_LIT:w>') as f:<EOL><INDENT>f.write('<STR_LIT:2>')<EOL><DEDENT>cp = ConfigParser.SafeConfigParser()<EOL>cp.read(srcdir + '<STR_LIT>')<EOL>if not cp.has_section('<STR_LIT>'):<EOL><INDENT>cp.add_section('<STR_LIT>')<EOL><DEDENT>cp.set('<STR_LIT>', '<STR_LIT:name>', name)<EOL>cp.set('<STR_LIT>', '<STR_LIT>', ckan_version)<EOL>if deploy_target:<EOL><INDENT>if not cp.has_section('<STR_LIT>'):<EOL><INDENT>cp.add_section('<STR_LIT>')<EOL><DEDENT>cp.set('<STR_LIT>', '<STR_LIT:target>', deploy_target)<EOL><DEDENT>if always_prod:<EOL><INDENT>cp.set('<STR_LIT>', '<STR_LIT>', '<STR_LIT:true>')<EOL><DEDENT>with open(srcdir + '<STR_LIT>', '<STR_LIT:w>') as config:<EOL><INDENT>cp.write(config)<EOL><DEDENT>save_srcdir_location(datadir, srcdir)<EOL>
Save an environment's configuration to the source dir and data dir