class Documentation(object): """ Represents and handles the creation of the documentation files from a project. """ def __init__(self, data, proj_docs, project, pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data['parallel']) self.parallel = self.njobs > 0 self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if not graphviz_installed and data['graph'].lower() == 'true': print( "Warning: Will not be able to generate graphs. Graphviz not installed." ) if self.data['relative']: graphparent = '../' else: graphparent = '' print("Creating HTML documentation...") try: if data['incl_src'] == 'true': for item in project.allfiles: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures: self.docs.append(ProcPage(data, project, item)) for item in project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules: self.docs.append(ModulePage(data, project, item)) for item in project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) for item in project.blockdata: self.docs.append(BlockPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if data['incl_src'] == 'true': if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data, project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit( 'Error encountered. Run with "--debug" flag for traceback.' ) if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), graphparent, self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), graphparent, self.data['coloured_edges'].lower() == 'true') project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], '') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], data['project_url']) self.tipue.create_node(self.index.html, 'index.html', {'category': 'home'}) jobs = len(self.docs) + len(self.pagetree) progbar = tqdm(chain(iter(self.docs), iter(self.pagetree)), total=jobs, unit='', file=sys.stdout) for i, p in enumerate(progbar): self.tipue.create_node(p.html, p.loc, p.meta) print('') def writeout(self): print("Writing resulting documentation.") out_dir = self.data['output_dir'] try: if os.path.isfile(out_dir): os.remove(out_dir) elif os.path.isdir(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir, 0o755) except Exception as e: print('Error: Could not create output directory. {}'.format( e.args[0])) os.mkdir(os.path.join(out_dir, 'lists'), 0o755) os.mkdir(os.path.join(out_dir, 'sourcefile'), 0o755) os.mkdir(os.path.join(out_dir, 'type'), 0o755) os.mkdir(os.path.join(out_dir, 'proc'), 0o755) os.mkdir(os.path.join(out_dir, 'interface'), 0o755) os.mkdir(os.path.join(out_dir, 'module'), 0o755) os.mkdir(os.path.join(out_dir, 'program'), 0o755) os.mkdir(os.path.join(out_dir, 'src'), 0o755) os.mkdir(os.path.join(out_dir, 'blockdata'), 0o755) copytree(os.path.join(loc, 'css'), os.path.join(out_dir, 'css')) copytree(os.path.join(loc, 'fonts'), os.path.join(out_dir, 'fonts')) copytree(os.path.join(loc, 'js'), os.path.join(out_dir, 'js')) if self.data['graph'].lower() == 'true': self.graphs.output_graphs(self.njobs) if self.data['search'].lower() == 'true': copytree(os.path.join(loc, 'tipuesearch'), os.path.join(out_dir, 'tipuesearch')) self.tipue.print_output() if 'media_dir' in self.data: try: copytree(self.data['media_dir'], os.path.join(out_dir, 'media')) except: print('Warning: error copying media directory {}'.format( self.data['media_dir'])) if 'css' in self.data: shutil.copy(self.data['css'], os.path.join(out_dir, 'css', 'user.css')) if self.data['favicon'] == 'default-icon': shutil.copy(os.path.join(loc, 'favicon.png'), os.path.join(out_dir, 'favicon.png')) else: shutil.copy(self.data['favicon'], os.path.join(out_dir, 'favicon.png')) if self.data['incl_src'] == 'true': for src in self.project.allfiles: shutil.copy(src.path, os.path.join(out_dir, 'src', src.name)) if 'mathjax_config' in self.data: os.mkdir(os.path.join(out_dir, 'js', 'MathJax-config')) shutil.copy( self.data['mathjax_config'], os.path.join(out_dir, 'js', 'MathJax-config', os.path.basename(self.data['mathjax_config']))) # By doing this we omit a duplication of data. for p in self.docs: p.writeout() for p in self.lists: p.writeout() for p in self.pagetree: p.writeout() self.index.writeout() self.search.writeout()
def __init__(self, data, proj_docs, project, pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data['parallel']) self.parallel = self.njobs > 0 self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if not graphviz_installed and data['graph'].lower() == 'true': print( "Warning: Will not be able to generate graphs. Graphviz not installed." ) if self.data['relative']: graphparent = '../' else: graphparent = '' print("Creating HTML documentation...") try: if data['incl_src'] == 'true': for item in project.allfiles: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures: self.docs.append(ProcPage(data, project, item)) for item in project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules: self.docs.append(ModulePage(data, project, item)) for item in project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) for item in project.blockdata: self.docs.append(BlockPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if data['incl_src'] == 'true': if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data, project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit( 'Error encountered. Run with "--debug" flag for traceback.' ) if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), graphparent, self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), graphparent, self.data['coloured_edges'].lower() == 'true') project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], '') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], data['project_url']) self.tipue.create_node(self.index.html, 'index.html', {'category': 'home'}) jobs = len(self.docs) + len(self.pagetree) progbar = tqdm(chain(iter(self.docs), iter(self.pagetree)), total=jobs, unit='', file=sys.stdout) for i, p in enumerate(progbar): self.tipue.create_node(p.html, p.loc, p.meta) print('')
class Documentation(object): """ Represents and handles the creation of the documentation files from a project. """ def __init__(self,data,proj_docs,project,pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data['parallel']) self.parallel = self.njobs>0 self.index = IndexPage(data,project,proj_docs) self.search = SearchPage(data,project) if not graphviz_installed and data['graph'].lower() == 'true': print("Warning: Will not be able to generate graphs. Graphviz not installed.") if self.data['relative']: graphparent = '../' else: graphparent = '' if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager(self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir',''), graphparent, self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager(self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir',''), graphparent, self.data['coloured_edges'].lower() == 'true') project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' try: for item in project.allfiles: self.docs.append(FilePage(data,project,item)) for item in project.types: self.docs.append(TypePage(data,project,item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data,project,item)) for item in project.procedures: self.docs.append(ProcPage(data,project,item)) for item in project.submodprocedures: self.docs.append(ProcPage(data,project,item)) for item in project.modules: self.docs.append(ModulePage(data,project,item)) for item in project.submodules: self.docs.append(ModulePage(data,project,item)) for item in project.programs: self.docs.append(ProgPage(data,project,item)) for item in project.blockdata: self.docs.append(BlockPage(data,project,item)) if len(project.procedures) > 0: self.lists.append(ProcList(data,project)) if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data,project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data,project)) if len(project.programs) > 1: self.lists.append(ProgList(data,project)) if len(project.types) > 0: self.lists.append(TypeList(data,project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data,project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data,project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data,project,item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],'') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],data['project_url']) self.tipue.create_node(self.index.html,'index.html', {'category': 'home'}) ndocs = len(self.docs) percent = (ndocs+len(self.pagetree))//100 for i,p in enumerate(self.docs): self.tipue.create_node(p.html,p.loc,p.obj.meta) if (i % percent == 0): sys.stdout.write('.') sys.stdout.flush() for i,p in enumerate(self.pagetree): self.tipue.create_node(p.html,p.loc) if ((i+ndocs) % percent == 0): sys.stdout.write('.') sys.stdout.flush() print('') def writeout(self): print("Writing HTML documentation...") out_dir = self.data['output_dir'] try: if os.path.isfile(out_dir): os.remove(out_dir) elif os.path.isdir(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir, 0o755) except Exception as e: print('Error: Could not create output directory. {}'.format(e.args[0])) os.mkdir(os.path.join(out_dir,'lists'), 0o755) os.mkdir(os.path.join(out_dir,'sourcefile'), 0o755) os.mkdir(os.path.join(out_dir,'type'), 0o755) os.mkdir(os.path.join(out_dir,'proc'), 0o755) os.mkdir(os.path.join(out_dir,'interface'), 0o755) os.mkdir(os.path.join(out_dir,'module'), 0o755) os.mkdir(os.path.join(out_dir,'program'), 0o755) os.mkdir(os.path.join(out_dir,'src'), 0o755) os.mkdir(os.path.join(out_dir,'blockdata'), 0o755) copytree(os.path.join(loc,'css'), os.path.join(out_dir,'css')) copytree(os.path.join(loc,'fonts'), os.path.join(out_dir,'fonts')) copytree(os.path.join(loc,'js'), os.path.join(out_dir,'js')) if self.data['graph'].lower() == 'true': self.graphs.output_graphs(self.njobs) if self.data['search'].lower() == 'true': copytree(os.path.join(loc,'tipuesearch'),os.path.join(out_dir,'tipuesearch')) self.tipue.print_output() if 'media_dir' in self.data: try: copytree(self.data['media_dir'],os.path.join(out_dir,'media')) except: print('Warning: error copying media directory {}'.format(self.data['media_dir'])) if 'css' in self.data: shutil.copy(self.data['css'],os.path.join(out_dir,'css','user.css')) if self.data['favicon'] == 'default-icon': shutil.copy(os.path.join(loc,'favicon.png'),os.path.join(out_dir,'favicon.png')) else: shutil.copy(self.data['favicon'],os.path.join(out_dir,'favicon.png')) for src in self.project.allfiles: shutil.copy(src.path,os.path.join(out_dir,'src',src.name)) if 'mathjax_config' in self.data: shutil.copy(self.data['mathjax_config'], os.path.join(out_dir, os.path.join('js/MathJax-config', os.path.basename(self.data['mathjax_config'])))) # By doing this we omit a duplication of data. for p in self.docs: p.writeout() for p in self.lists: p.writeout() for p in self.pagetree: p.writeout() self.index.writeout() self.search.writeout()
def __init__(self,data,proj_docs,project,pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data['parallel']) self.parallel = self.njobs>0 self.index = IndexPage(data,project,proj_docs) self.search = SearchPage(data,project) if not graphviz_installed and data['graph'].lower() == 'true': print("Warning: Will not be able to generate graphs. Graphviz not installed.") if self.data['relative']: graphparent = '../' else: graphparent = '' if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager(self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir',''), graphparent, self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager(self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir',''), graphparent, self.data['coloured_edges'].lower() == 'true') project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' try: for item in project.allfiles: self.docs.append(FilePage(data,project,item)) for item in project.types: self.docs.append(TypePage(data,project,item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data,project,item)) for item in project.procedures: self.docs.append(ProcPage(data,project,item)) for item in project.submodprocedures: self.docs.append(ProcPage(data,project,item)) for item in project.modules: self.docs.append(ModulePage(data,project,item)) for item in project.submodules: self.docs.append(ModulePage(data,project,item)) for item in project.programs: self.docs.append(ProgPage(data,project,item)) for item in project.blockdata: self.docs.append(BlockPage(data,project,item)) if len(project.procedures) > 0: self.lists.append(ProcList(data,project)) if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data,project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data,project)) if len(project.programs) > 1: self.lists.append(ProgList(data,project)) if len(project.types) > 0: self.lists.append(TypeList(data,project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data,project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data,project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data,project,item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],'') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],data['project_url']) self.tipue.create_node(self.index.html,'index.html', {'category': 'home'}) ndocs = len(self.docs) percent = (ndocs+len(self.pagetree))//100 for i,p in enumerate(self.docs): self.tipue.create_node(p.html,p.loc,p.obj.meta) if (i % percent == 0): sys.stdout.write('.') sys.stdout.flush() for i,p in enumerate(self.pagetree): self.tipue.create_node(p.html,p.loc) if ((i+ndocs) % percent == 0): sys.stdout.write('.') sys.stdout.flush() print('')
class Documentation(object): """ Represents and handles the creation of the documentation files from a project. """ def __init__(self,data,proj_docs,project,pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] if data['relative']: ford.sourceform.set_base_url('.') ford.pagetree.set_base_url('.') data['project_url'] = '.' self.index = IndexPage(data,project,proj_docs) self.search = SearchPage(data,project) if data['relative']: ford.sourceform.set_base_url('..') ford.pagetree.set_base_url('..') data['project_url'] = '..' if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager(self.data['project_url'],self.data['output_dir'], self.data.get('graph_dir',''), self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures + project.submodprocedures: self.graphs.register(item) for item in project.modules + project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' print("Creating HTML documentation...") try: for item in project.allfiles: self.docs.append(FilePage(data,project,item)) for item in project.types: self.docs.append(TypePage(data,project,item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data,project,item)) for item in project.procedures + project.submodprocedures: self.docs.append(ProcPage(data,project,item)) for item in project.modules + project.submodules: self.docs.append(ModulePage(data,project,item)) for item in project.programs: self.docs.append(ProgPage(data,project,item)) for item in project.blockdata: self.docs.append(BlockPage(data,project,item)) if len(project.procedures) > 0: self.lists.append(ProcList(data,project)) if len(project.allfiles) > 1: self.lists.append(FileList(data,project)) if len(project.modules + project.submodules) > 0: self.lists.append(ModList(data,project)) if len(project.programs) > 1: self.lists.append(ProgList(data,project)) if len(project.types) > 0: self.lists.append(TypeList(data,project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data,project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data,project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data,project,item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],'') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],data['project_url']) self.tipue.create_node(self.index.html,'index.html', {'categroy': 'home'}) for p in self.docs: self.tipue.create_node(p.html,p.loc,p.obj.meta) for p in self.pagetree: self.tipue.create_node(p.html,p.loc) def writeout(self): out_dir = self.data['output_dir'] try: if os.path.isfile(out_dir): os.remove(out_dir) elif os.path.isdir(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir, 0o755) except Exception as e: print('Error: Could not create output directory. {}'.format(e.args[0])) os.mkdir(os.path.join(out_dir,'lists'), 0o755) os.mkdir(os.path.join(out_dir,'sourcefile'), 0o755) os.mkdir(os.path.join(out_dir,'type'), 0o755) os.mkdir(os.path.join(out_dir,'proc'), 0o755) os.mkdir(os.path.join(out_dir,'interface'), 0o755) os.mkdir(os.path.join(out_dir,'module'), 0o755) os.mkdir(os.path.join(out_dir,'program'), 0o755) os.mkdir(os.path.join(out_dir,'src'), 0o755) os.mkdir(os.path.join(out_dir,'blockdata'), 0o755) copytree(os.path.join(loc,'css'), os.path.join(out_dir,'css')) copytree(os.path.join(loc,'fonts'), os.path.join(out_dir,'fonts')) copytree(os.path.join(loc,'js'), os.path.join(out_dir,'js')) if self.data['graph'].lower() == 'true': self.graphs.output_graphs() if self.data['search'].lower() == 'true': copytree(os.path.join(loc,'tipuesearch'),os.path.join(out_dir,'tipuesearch')) self.tipue.print_output() if 'media_dir' in self.data: try: copytree(self.data['media_dir'],os.path.join(out_dir,'media')) except: print('Warning: error copying media directory {}'.format(self.data['media_dir'])) if 'css' in self.data: shutil.copy(self.data['css'],os.path.join(out_dir,'css','user.css')) if self.data['favicon'] == 'default-icon': shutil.copy(os.path.join(loc,'favicon.png'),os.path.join(out_dir,'favicon.png')) else: shutil.copy(self.data['favicon'],os.path.join(out_dir,'favicon.png')) for src in self.project.allfiles: shutil.copy(src.path,os.path.join(out_dir,'src',src.name)) for p in self.docs + self.lists + self.pagetree + [self.index, self.search]: p.writeout()
def __init__(self,data,proj_docs,project,pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] if data['relative']: ford.sourceform.set_base_url('.') ford.pagetree.set_base_url('.') data['project_url'] = '.' self.index = IndexPage(data,project,proj_docs) self.search = SearchPage(data,project) if data['relative']: ford.sourceform.set_base_url('..') ford.pagetree.set_base_url('..') data['project_url'] = '..' if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager(self.data['project_url'],self.data['output_dir'], self.data.get('graph_dir',''), self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures + project.submodprocedures: self.graphs.register(item) for item in project.modules + project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' print("Creating HTML documentation...") try: for item in project.allfiles: self.docs.append(FilePage(data,project,item)) for item in project.types: self.docs.append(TypePage(data,project,item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data,project,item)) for item in project.procedures + project.submodprocedures: self.docs.append(ProcPage(data,project,item)) for item in project.modules + project.submodules: self.docs.append(ModulePage(data,project,item)) for item in project.programs: self.docs.append(ProgPage(data,project,item)) for item in project.blockdata: self.docs.append(BlockPage(data,project,item)) if len(project.procedures) > 0: self.lists.append(ProcList(data,project)) if len(project.allfiles) > 1: self.lists.append(FileList(data,project)) if len(project.modules + project.submodules) > 0: self.lists.append(ModList(data,project)) if len(project.programs) > 1: self.lists.append(ProgList(data,project)) if len(project.types) > 0: self.lists.append(TypeList(data,project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data,project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data,project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data,project,item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],'') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator(data['output_dir'],data['project_url']) self.tipue.create_node(self.index.html,'index.html', {'categroy': 'home'}) for p in self.docs: self.tipue.create_node(p.html,p.loc,p.obj.meta) for p in self.pagetree: self.tipue.create_node(p.html,p.loc)
def __init__(self, data, proj_docs, project, pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] if data['relative']: ford.sourceform.set_base_url('.') ford.pagetree.set_base_url('.') data['project_url'] = '.' self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if data['relative']: ford.sourceform.set_base_url('..') ford.pagetree.set_base_url('..') data['project_url'] = '..' if not graphviz_installed and data['graph'].lower() == 'true': print( "Warning: Will not be able to generate graphs. Graphviz not installed." ) if graphviz_installed and data['graph'].lower() == 'true': print('Generating graphs...') self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), self.data['coloured_edges'].lower() == 'true') for item in project.types: self.graphs.register(item) for item in project.procedures + project.submodprocedures: self.graphs.register(item) for item in project.modules + project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager( self.data['project_url'], self.data['output_dir'], self.data.get('graph_dir', ''), self.data['coloured_edges'].lower() == 'true') project.callgraph = '' project.typegraph = '' project.usegraph = '' project.filegraph = '' print("Creating HTML documentation...") try: for item in project.allfiles: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures + project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules + project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) for item in project.blockdata: self.docs.append(BlockPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if len(project.allfiles) > 1: self.lists.append(FileList(data, project)) if len(project.modules + project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit( 'Error encountered. Run with "--debug" flag for traceback.' ) if data['search'].lower() == 'true': print('Creating search index...') if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], '') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], data['project_url']) self.tipue.create_node(self.index.html, 'index.html', {'categroy': 'home'}) for p in self.docs: self.tipue.create_node(p.html, p.loc, p.obj.meta) for p in self.pagetree: self.tipue.create_node(p.html, p.loc)
def __init__(self, data, proj_docs, project, pagetree): env.globals[ "projectData" ] = data # This lets us use meta data anywhere within the template. # Also, in future for other template, we may not need to # pass the data obj. self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data["parallel"]) self.parallel = self.njobs > 0 self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if not graphviz_installed and data["graph"].lower() == "true": print( "Warning: Will not be able to generate graphs. Graphviz not installed." ) if self.data["relative"]: graphparent = "../" else: graphparent = "" print("Creating HTML documentation...") try: if data["incl_src"] == "true": for item in project.allfiles: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures: self.docs.append(ProcPage(data, project, item)) for item in project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules: self.docs.append(ModulePage(data, project, item)) for item in project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) for item in project.blockdata: self.docs.append(BlockPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if data["incl_src"] == "true": if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data, project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception: if data["dbg"]: traceback.print_exc() sys.exit("Error encountered.") else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if graphviz_installed and data["graph"].lower() == "true": print("Generating graphs...") self.graphs = GraphManager( self.data["project_url"], self.data["output_dir"], self.data.get("graph_dir", ""), graphparent, self.data["coloured_edges"].lower() == "true", ) for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager( self.data["project_url"], self.data["output_dir"], self.data.get("graph_dir", ""), graphparent, self.data["coloured_edges"].lower() == "true", ) project.callgraph = "" project.typegraph = "" project.usegraph = "" project.filegraph = "" if data["search"].lower() == "true": print("Creating search index...") if data["relative"]: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data["output_dir"], "" ) else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data["output_dir"], data["project_url"] ) self.tipue.create_node(self.index.html, "index.html", {"category": "home"}) jobs = len(self.docs) + len(self.pagetree) progbar = tqdm( chain(iter(self.docs), iter(self.pagetree)), total=jobs, unit="", file=sys.stdout, ) for i, p in enumerate(progbar): self.tipue.create_node(p.html, p.loc, p.meta) print("")
class Documentation(object): """ Represents and handles the creation of the documentation files from a project. """ def __init__(self, data, proj_docs, project, pagetree): env.globals[ "projectData" ] = data # This lets us use meta data anywhere within the template. # Also, in future for other template, we may not need to # pass the data obj. self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] self.njobs = int(self.data["parallel"]) self.parallel = self.njobs > 0 self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if not graphviz_installed and data["graph"].lower() == "true": print( "Warning: Will not be able to generate graphs. Graphviz not installed." ) if self.data["relative"]: graphparent = "../" else: graphparent = "" print("Creating HTML documentation...") try: if data["incl_src"] == "true": for item in project.allfiles: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures: self.docs.append(ProcPage(data, project, item)) for item in project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules: self.docs.append(ModulePage(data, project, item)) for item in project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) for item in project.blockdata: self.docs.append(BlockPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if data["incl_src"] == "true": if len(project.files) + len(project.extra_files) > 1: self.lists.append(FileList(data, project)) if len(project.modules) + len(project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if len(project.blockdata) > 1: self.lists.append(BlockList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception: if data["dbg"]: traceback.print_exc() sys.exit("Error encountered.") else: sys.exit('Error encountered. Run with "--debug" flag for traceback.') if graphviz_installed and data["graph"].lower() == "true": print("Generating graphs...") self.graphs = GraphManager( self.data["project_url"], self.data["output_dir"], self.data.get("graph_dir", ""), graphparent, self.data["coloured_edges"].lower() == "true", ) for item in project.types: self.graphs.register(item) for item in project.procedures: self.graphs.register(item) for item in project.submodprocedures: self.graphs.register(item) for item in project.modules: self.graphs.register(item) for item in project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) for item in project.files: self.graphs.register(item) for item in project.blockdata: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph project.filegraph = self.graphs.filegraph else: self.graphs = GraphManager( self.data["project_url"], self.data["output_dir"], self.data.get("graph_dir", ""), graphparent, self.data["coloured_edges"].lower() == "true", ) project.callgraph = "" project.typegraph = "" project.usegraph = "" project.filegraph = "" if data["search"].lower() == "true": print("Creating search index...") if data["relative"]: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data["output_dir"], "" ) else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data["output_dir"], data["project_url"] ) self.tipue.create_node(self.index.html, "index.html", {"category": "home"}) jobs = len(self.docs) + len(self.pagetree) progbar = tqdm( chain(iter(self.docs), iter(self.pagetree)), total=jobs, unit="", file=sys.stdout, ) for i, p in enumerate(progbar): self.tipue.create_node(p.html, p.loc, p.meta) print("") def writeout(self): print("Writing resulting documentation.") out_dir = self.data["output_dir"] try: if os.path.isfile(out_dir): os.remove(out_dir) elif os.path.isdir(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir, 0o755) except Exception as e: print("Error: Could not create output directory. {}".format(e.args[0])) os.mkdir(os.path.join(out_dir, "lists"), 0o755) os.mkdir(os.path.join(out_dir, "sourcefile"), 0o755) os.mkdir(os.path.join(out_dir, "type"), 0o755) os.mkdir(os.path.join(out_dir, "proc"), 0o755) os.mkdir(os.path.join(out_dir, "interface"), 0o755) os.mkdir(os.path.join(out_dir, "module"), 0o755) os.mkdir(os.path.join(out_dir, "program"), 0o755) os.mkdir(os.path.join(out_dir, "src"), 0o755) os.mkdir(os.path.join(out_dir, "blockdata"), 0o755) copytree(os.path.join(loc, "css"), os.path.join(out_dir, "css")) copytree(os.path.join(loc, "fonts"), os.path.join(out_dir, "fonts")) copytree(os.path.join(loc, "js"), os.path.join(out_dir, "js")) if self.data["graph"].lower() == "true": self.graphs.output_graphs(self.njobs) if self.data["search"].lower() == "true": copytree( os.path.join(loc, "tipuesearch"), os.path.join(out_dir, "tipuesearch") ) self.tipue.print_output() if "media_dir" in self.data: try: copytree(self.data["media_dir"], os.path.join(out_dir, "media")) except OSError: print( "Warning: error copying media directory {}".format( self.data["media_dir"] ) ) if "css" in self.data: shutil.copy(self.data["css"], os.path.join(out_dir, "css", "user.css")) if self.data["favicon"] == "default-icon": shutil.copy( os.path.join(loc, "favicon.png"), os.path.join(out_dir, "favicon.png") ) else: shutil.copy(self.data["favicon"], os.path.join(out_dir, "favicon.png")) if self.data["incl_src"] == "true": for src in self.project.allfiles: shutil.copy(src.path, os.path.join(out_dir, "src", src.name)) if "mathjax_config" in self.data: os.mkdir(os.path.join(out_dir, "js", "MathJax-config")) shutil.copy( self.data["mathjax_config"], os.path.join( out_dir, "js", "MathJax-config", os.path.basename(self.data["mathjax_config"]), ), ) # By doing this we omit a duplication of data. for p in self.docs: p.writeout() for p in self.lists: p.writeout() for p in self.pagetree: p.writeout() self.index.writeout() self.search.writeout()
def __init__(self, data, proj_docs, project, pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] if data['relative']: ford.sourceform.set_base_url('.') ford.pagetree.set_base_url('.') data['project_url'] = '.' self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if data['relative']: ford.sourceform.set_base_url('..') ford.pagetree.set_base_url('..') data['project_url'] = '..' self.graphs = GraphManager(data['project_url'], self.data['output_dir'], 'graphs') for item in project.types: self.graphs.register(item) for item in project.procedures + project.submodprocedures: self.graphs.register(item) for item in project.modules + project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph try: for item in project.files: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures + project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules + project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if len(project.files) > 1: self.lists.append(FileList(data, project)) if len(project.modules + project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit( 'Error encountered. Run with "--debug" flag for traceback.' ) if data['search'].lower() == 'true': if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], '') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], data['project_url']) self.tipue.create_node(self.index.html, 'index.html', {'categroy': 'home'}) for p in self.docs: self.tipue.create_node(p.html, p.loc, p.obj.meta) for p in self.pagetree: self.tipue.create_node(p.html, p.loc)
class Documentation(object): """ Represents and handles the creation of the documentation files from a project. """ def __init__(self, data, proj_docs, project, pagetree): self.project = project self.data = data self.pagetree = [] self.lists = [] self.docs = [] if data['relative']: ford.sourceform.set_base_url('.') ford.pagetree.set_base_url('.') data['project_url'] = '.' self.index = IndexPage(data, project, proj_docs) self.search = SearchPage(data, project) if data['relative']: ford.sourceform.set_base_url('..') ford.pagetree.set_base_url('..') data['project_url'] = '..' self.graphs = GraphManager(data['project_url'], self.data['output_dir'], 'graphs') for item in project.types: self.graphs.register(item) for item in project.procedures + project.submodprocedures: self.graphs.register(item) for item in project.modules + project.submodules: self.graphs.register(item) for item in project.programs: self.graphs.register(item) self.graphs.graph_all() project.callgraph = self.graphs.callgraph project.typegraph = self.graphs.typegraph project.usegraph = self.graphs.usegraph try: for item in project.files: self.docs.append(FilePage(data, project, item)) for item in project.types: self.docs.append(TypePage(data, project, item)) for item in project.absinterfaces: self.docs.append(AbsIntPage(data, project, item)) for item in project.procedures + project.submodprocedures: self.docs.append(ProcPage(data, project, item)) for item in project.modules + project.submodules: self.docs.append(ModulePage(data, project, item)) for item in project.programs: self.docs.append(ProgPage(data, project, item)) if len(project.procedures) > 0: self.lists.append(ProcList(data, project)) if len(project.files) > 1: self.lists.append(FileList(data, project)) if len(project.modules + project.submodules) > 0: self.lists.append(ModList(data, project)) if len(project.programs) > 1: self.lists.append(ProgList(data, project)) if len(project.types) > 0: self.lists.append(TypeList(data, project)) if len(project.absinterfaces) > 0: self.lists.append(AbsIntList(data, project)) if pagetree: for item in pagetree: self.pagetree.append(PagetreePage(data, project, item)) except Exception as e: if data['dbg']: traceback.print_exc() sys.exit('Error encountered.') else: sys.exit( 'Error encountered. Run with "--debug" flag for traceback.' ) if data['search'].lower() == 'true': if data['relative']: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], '') else: self.tipue = ford.tipue_search.Tipue_Search_JSON_Generator( data['output_dir'], data['project_url']) self.tipue.create_node(self.index.html, 'index.html', {'categroy': 'home'}) for p in self.docs: self.tipue.create_node(p.html, p.loc, p.obj.meta) for p in self.pagetree: self.tipue.create_node(p.html, p.loc) def writeout(self): out_dir = self.data['output_dir'] try: if os.path.isfile(out_dir): os.remove(out_dir) elif os.path.isdir(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir, 0o755) except Exception as e: print('Error: Could not create output directory. {}'.format( e.args[0])) os.mkdir(os.path.join(out_dir, 'lists'), 0o755) os.mkdir(os.path.join(out_dir, 'sourcefile'), 0o755) os.mkdir(os.path.join(out_dir, 'type'), 0o755) os.mkdir(os.path.join(out_dir, 'proc'), 0o755) os.mkdir(os.path.join(out_dir, 'interface'), 0o755) os.mkdir(os.path.join(out_dir, 'module'), 0o755) os.mkdir(os.path.join(out_dir, 'program'), 0o755) os.mkdir(os.path.join(out_dir, 'src'), 0o755) copytree(os.path.join(loc, 'css'), os.path.join(out_dir, 'css')) copytree(os.path.join(loc, 'fonts'), os.path.join(out_dir, 'fonts')) copytree(os.path.join(loc, 'js'), os.path.join(out_dir, 'js')) self.graphs.output_graphs() if self.data['search'].lower() == 'true': copytree(os.path.join(loc, 'tipuesearch'), os.path.join(out_dir, 'tipuesearch')) self.tipue.print_output() if 'media_dir' in self.data: try: copytree(self.data['media_dir'], os.path.join(out_dir, 'media')) except: print('Warning: error copying media directory {}'.format( self.data['media_dir'])) if 'css' in self.data: shutil.copy(self.data['css'], os.path.join(out_dir, 'css', 'user.css')) if self.data['favicon'] == 'default-icon': shutil.copy(os.path.join(loc, 'favicon.png'), os.path.join(out_dir, 'favicon.png')) else: shutil.copy(self.data['favicon'], os.path.join(out_dir, 'favicon.png')) for src in self.project.files: shutil.copy(src.path, os.path.join(out_dir, 'src', src.name)) for p in self.docs + self.lists + self.pagetree + [ self.index, self.search ]: p.writeout()