def _create_perfdocs(self): ''' Creates the perfdocs documentation. :return: str path of the temp dir it is saved in ''' # All directories that are kept in the perfdocs tree are valid, # so use it to build up the documentation. framework_docs = self.build_perfdocs_from_tree() perfdocs_tmpdir = self._create_temp_dir() # Save the documentation files frameworks = [] for framework_name in sorted(framework_docs.keys()): frameworks.append(framework_name) save_file(framework_docs[framework_name], os.path.join(perfdocs_tmpdir, framework_name)) # Get the main page and add the framework links to it mainpage = read_file(os.path.join(self.templates_path, "index.rst"), stringify=True) fmt_frameworks = os.linesep.join( [' :doc:`%s`' % name for name in frameworks]) fmt_mainpage = re.sub(r"{test_documentation}", fmt_frameworks, mainpage) save_file(fmt_mainpage, os.path.join(perfdocs_tmpdir, 'index')) return perfdocs_tmpdir
def _create_perfdocs(self): """ Creates the perfdocs documentation. :return: str path of the temp dir it is saved in """ # All directories that are kept in the perfdocs tree are valid, # so use it to build up the documentation. framework_docs = self.build_perfdocs_from_tree() perfdocs_tmpdir = self._create_temp_dir() # Save the documentation files frameworks = [] for framework_name in sorted(framework_docs.keys()): frameworks.append(framework_name) save_file( framework_docs[framework_name]["dynamic"], os.path.join(perfdocs_tmpdir, framework_name), ) for static_name in framework_docs[framework_name]["static"]: save_file( static_name["content"], os.path.join(perfdocs_tmpdir, static_name["file"].split(".")[0]), ) # Get the main page and add the framework links to it mainpage = read_file( os.path.join(self.templates_path, "index.rst"), stringify=True ) fmt_frameworks = os.linesep.join( [" * :doc:`%s`" % name for name in frameworks] ) fmt_mainpage = re.sub(r"{test_documentation}", fmt_frameworks, mainpage) save_file(fmt_mainpage, os.path.join(perfdocs_tmpdir, "index")) return perfdocs_tmpdir