Exemplo n.º 1
0
    def append_conf(self, **kwargs):
        """Modify the given ``conf.py`` file from a whitelisted user's project.
        """

        # Pull config data
        try:
            self.state.conf_file
        except BuildException:
            self._write_config()
            # self.create_index(extension='rst')

        # # Open file for appending.
        json_file = codecs.open(self.state.rtd_json_file,
                                encoding='utf-8',
                                mode='w+')
        json_file.write(obj_to_json(self.state))
        json_file.close()

        outfile = codecs.open(self.state.rtd_conf_file,
                              encoding='utf-8',
                              mode='w+')
        rtd_string = render.render_to_string('doc_builder/conf.py.tmpl',
                                             state=self.state)
        outfile.write(rtd_string)
        outfile.close()
Exemplo n.º 2
0
 def _write_config(self):
     """
     Create ``conf.py`` if it doesn't exist.
     """
     docs_dir = self.docs_dir()
     conf_template = render.render_to_string('sphinx/conf.py.conf',
                                             project=self.state.project,
                                             version=self.state.version,
                                             template_dir=TEMPLATE_DIR,
                                             )
     conf_file = os.path.join(docs_dir, 'conf.py')
     safe_write(conf_file, conf_template)
Exemplo n.º 3
0
 def _write_config(self):
     """
     Create ``conf.py`` if it doesn't exist.
     """
     docs_dir = self.docs_dir()
     conf_template = render.render_to_string(
         'sphinx/conf.py.conf',
         project=self.state.project,
         version=self.state.version,
         template_dir=TEMPLATE_DIR,
     )
     conf_file = os.path.join(docs_dir, 'conf.py')
     safe_write(conf_file, conf_template)
Exemplo n.º 4
0
    def append_conf(self, **kwargs):
        """Modify the given ``conf.py`` file from a whitelisted user's project.
        """

        # Pull config data
        try:
            self.state.conf_file
        except BuildException:
            self._write_config()
            # self.create_index(extension='rst')

        # # Open file for appending.
        json_file = codecs.open(self.state.rtd_json_file, encoding='utf-8', mode='w+')
        json_file.write(obj_to_json(self.state))
        json_file.close()

        outfile = codecs.open(self.state.rtd_conf_file, encoding='utf-8', mode='w+')
        rtd_string = render.render_to_string('doc_builder/conf.py.tmpl', state=self.state)
        outfile.write(rtd_string)
        outfile.close()