7"""Generate Doxygen documentation."""
17DOXYFILE_BASENAME =
'Doxyfile'
18DOXYGEN_BINARY =
'doxygen'
19WORKDIR = os.path.join(os.pardir,
'doxygen_workdir')
20DOXYGEN_CONFIG_DIR = os.path.join(WORKDIR,
'doxygen-config')
21DOXYGEN_WORKING_DIR = os.path.join(WORKDIR,
'doxygen')
22DOXYGEN_GS_PATH =
'/'.
join([
'gs://skia-doc',
'doxygen'])
24IFRAME_FOOTER_TEMPLATE =
"""
25<html><body><address style="text-align: right;"><small>
26Generated at %s for skia
27by <a href="http://www.doxygen.org/index.html">doxygen</a>
28%s </small></address></body></html>
33 """Delete and recreate the directory."""
37 if os.path.exists(path):
38 raise Exception(
'Could not remove %s' % path)
43 """Generate Doxygen."""
46 static_footer_path = os.path.join(DOXYGEN_WORKING_DIR,
'static_footer.txt')
47 shutil.copyfile(os.path.join(
'tools',
'doxygen_footer.txt'),
53 modified_doxyfile = os.path.join(DOXYGEN_CONFIG_DIR, DOXYFILE_BASENAME)
54 with open(DOXYFILE_BASENAME,
'r')
as reader:
55 with open(modified_doxyfile,
'w')
as writer:
56 shutil.copyfileobj(reader, writer)
57 writer.write(
'OUTPUT_DIRECTORY = %s\n' % DOXYGEN_WORKING_DIR)
58 writer.write(
'HTML_FOOTER = %s\n' % static_footer_path)
59 subprocess.check_call([DOXYGEN_BINARY, modified_doxyfile])
62 with open(os.path.join(DOXYGEN_WORKING_DIR,
'iframe_footer.html'),
'w')
as f:
63 f.write(IFRAME_FOOTER_TEMPLATE % (
64 datetime.datetime.now().isoformat(
' '),
65 subprocess.check_output([DOXYGEN_BINARY,
'--version']).rstrip()))
68 cmd = [
'gsutil',
'cp',
'-a',
'public-read',
'-R',
69 DOXYGEN_WORKING_DIR, DOXYGEN_GS_PATH]
70 subprocess.check_call(cmd)
73if '__main__' == __name__:
def generate_and_upload_doxygen()
static SkString join(const CommandLineFlags::StringArray &)