def render_source(output_dir, package_spec):
path, name = package_spec.filepath<EOL>destination_filename = "<STR_LIT>" % (output_dir, name)<EOL>py_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)<EOL>with open(destination_filename, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(py_template.render(msgs=package_spec.definitions,<EOL>pkg_name=name,<EOL>filepath="<STR_LIT:/>".join(package_spec.filepath) + "<STR_LIT>",<EOL>max_msgid_len=package_spec.max_msgid_len,<EOL>description=package_spec.description,<EOL>timestamp=package_spec.creation_timestamp,<EOL>include=extensions(package_spec.includes)))<EOL><DEDENT>
Render and output to a directory given a package specification.