def _sanitize(self, project): conf_template = render_to_string('sphinx/conf.py', {'project': project, 'template_dir': TEMPLATE_DIR, 'badge': project.sponsored }) safe_write(project.conf_filename, conf_template)
def _write_config(self): """ Create ``conf.py`` if it doesn't exist. """ docs_dir = self.docs_dir() conf_template = render_to_string('sphinx/conf.py.conf', {'project': self.version.project, 'version': self.version, 'template_dir': TEMPLATE_DIR, }) conf_file = os.path.join(docs_dir, 'conf.py') safe_write(conf_file, conf_template)
def _sanitize(self, project): conf_template = render_to_string('sphinx/conf.py', {'project': project, 'template_dir': TEMPLATE_DIR, 'badge': project.sponsored }) rtd_ctx = Context({ 'verisons': project.active_versions(), 'project': project, 'static_path': STATIC_DIR, 'template_path': TEMPLATE_DIR, }) rtd_string = Template(RTD_CONF_ADDITIONS).render(rtd_ctx) conf_template = conf_template + "\n" + rtd_string safe_write(project.conf_filename, conf_template)
def update_created_docs(project): # grab the root path for the generated docs to live at path = project.doc_path doc_root = os.path.join(path, 'checkouts', 'latest', 'docs') if not os.path.exists(doc_root): os.makedirs(doc_root) project.path = doc_root project.save() #Touch a conf.py safe_write(os.path.join(project.path, 'conf.py'), '') project.write_index() for file in project.files.all(): file.write_to_disk()
def _sanitize(self, version): project = version.project conf_template = render_to_string('sphinx/conf.py.conf', {'project': project, 'template_dir': TEMPLATE_DIR, 'badge': project.sponsored }) rtd_ctx = Context({ 'verisons': project.active_versions(), 'current_version': version, 'project': project, 'settings': settings, 'static_path': STATIC_DIR, 'template_path': TEMPLATE_DIR, }) rtd_string = Template(RTD_CONF_ADDITIONS).render(rtd_ctx) conf_template = conf_template + "\n" + rtd_string safe_write(project.conf_file(version.slug), conf_template)
def _sanitize(self, version): project = version.project conf_template = render_to_string( "sphinx/conf.py.conf", {"project": project, "template_dir": TEMPLATE_DIR, "badge": project.sponsored} ) rtd_ctx = Context( { "verisons": project.active_versions(), "current_version": version, "project": project, "settings": settings, "static_path": STATIC_DIR, "template_path": TEMPLATE_DIR, } ) rtd_string = Template(RTD_CONF_ADDITIONS).render(rtd_ctx) conf_template = conf_template + "\n" + rtd_string safe_write(project.conf_file(version.slug), conf_template)
def _sanitize(self): project = self.version.project conf_template = render_to_string( 'sphinx/conf.py.conf', { 'project': project, 'template_dir': TEMPLATE_DIR, 'badge': project.sponsored }) rtd_ctx = Context({ 'verisons': project.active_versions(), 'current_version': self.version, 'project': project, 'settings': settings, 'static_path': STATIC_DIR, 'template_path': TEMPLATE_DIR, }) rtd_string = Template(RTD_CONF_ADDITIONS).render(rtd_ctx) conf_template = conf_template + "\n" + rtd_string safe_write(project.conf_file(self.version.slug), conf_template)
def update_created_docs(project): """ Handle generating the docs for projects hosted on RTD. """ # grab the root path for the generated docs to live at path = project.doc_path doc_root = os.path.join(path, 'checkouts', 'latest', 'docs') if not os.path.exists(doc_root): os.makedirs(doc_root) project.path = doc_root #project.save() #Touch a conf.py safe_write(os.path.join(project.path, 'conf.py'), '') project.write_index() for file in project.files.all(): file.write_to_disk()
def update_created_docs(project): """ Handle generating the docs for projects hosted on RTD. """ # grab the root path for the generated docs to live at path = project.doc_path doc_root = os.path.join(path, "checkouts", "latest", "docs") if not os.path.exists(doc_root): os.makedirs(doc_root) project.path = doc_root # project.save() # Touch a conf.py safe_write(os.path.join(project.path, "conf.py"), "") project.write_index() for file in project.files.all(): file.write_to_disk()
def write_to_disk(self): safe_write(self.filename, self.get_rendered())
def write_index(self): if not self.is_imported: safe_write(self.get_index_filename(), self.get_rendered_index())
def write_to_disk(self): safe_write(self.conf_filename, self.get_rendered_conf())