def main(): global _threadError num_threads = os.cpu_count() * 2 root_dir = path.join(utils.get_script_folder(), '..') docs_dir = path.join(root_dir, 'docs') xml_dir = path.join(docs_dir, 'xml') html_dir = path.join(docs_dir, 'html') mcss_dir = path.join(root_dir, 'extern', 'mcss') doxygen = path.join(mcss_dir, 'documentation', 'doxygen.py') # delete any previously generated html and xml utils.delete_directory(xml_dir) utils.delete_directory(html_dir) # run doxygen subprocess.check_call( ['doxygen', 'Doxyfile'], shell=True, cwd=docs_dir ) # fix some shit that's broken in the xml preprocess_xml(xml_dir) # run doxygen.py (m.css) utils.run_python_script(doxygen, path.join(docs_dir, 'Doxyfile-mcss'), '--no-doxygen') # delete xml utils.delete_directory(xml_dir) # post-process html files fixes = [ CustomTagsFix() , SyntaxHighlightingFix() #, NavBarFix() , IndexPageFix() , ModifiersFix1() , ModifiersFix2() , InlineNamespaceFix1() , InlineNamespaceFix2() , InlineNamespaceFix3() , ExtDocLinksFix() , EnableIfFix() , ExternalLinksFix() ] files = [path.split(f) for f in utils.get_all_files(html_dir, any=('*.html', '*.htm'))] if files: with futures.ThreadPoolExecutor(max_workers=min(len(files), num_threads)) as executor: jobs = { executor.submit(postprocess_file, dir, file, fixes) : file for dir, file in files } for job in futures.as_completed(jobs): if _threadError: executor.shutdown(False) break else: file = jobs[job] print('Finished processing {}.'.format(file)) if _threadError: return 1
def main(): hpp_path = Path(utils.entry_script_dir(), '..', 'toml.hpp').resolve() hash1 = utils.sha1(utils.read_all_text_from_file(hpp_path, logger=True)) print(rf'Hash 1: {hash1}') utils.run_python_script(r'generate_single_header.py') hash2 = utils.sha1(utils.read_all_text_from_file(hpp_path, logger=True)) print(rf'Hash 2: {hash2}') if (hash1 != hash2): print( "toml.hpp wasn't up-to-date!\nRun generate_single_header.py before your commit to prevent this error.", file=sys.stderr) return 1 print("toml.hpp was up-to-date") return 0
def main(): hpp_path = path.join(utils.get_script_folder(), '..', 'toml.hpp') hash1 = hashlib.sha1( utils.read_all_text_from_file(hpp_path).encode('utf-8')).hexdigest() print("Hash 1: {}".format(hash1)) utils.run_python_script('generate_single_header.py') hash2 = hashlib.sha1( utils.read_all_text_from_file(hpp_path).encode('utf-8')).hexdigest() print("Hash 2: {}".format(hash2)) if (hash1 != hash2): print( "toml.hpp wasn't up-to-date!\nRun generate_single_header.py before your commit to prevent this error.", file=sys.stderr) return 1 print("toml.hpp was up-to-date") return 0