def render_source(output_dir, package_spec):
path, name = package_spec.filepath<EOL>destination_filename = '<STR_LIT>' % (output_dir, name)<EOL>pb_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)<EOL>includes = [include[:-<NUM_LIT:5>] if include.endswith('<STR_LIT>') else include for include in package_spec.includes]<EOL>if '<STR_LIT>' in includes:<EOL><INDENT>includes.remove('<STR_LIT>')<EOL><DEDENT>with open(destination_filename, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(pb_template.render(<EOL>name=name,<EOL>package=package_spec.identifier,<EOL>messages=package_spec.definitions,<EOL>includes=includes,<EOL>description=package_spec.description,<EOL>))<EOL><DEDENT>
Render and output to a directory given a package specification.