From cef9811dac46a9d54dab0f0d82ce5c3ae032fc7c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 4 Oct 2010 18:21:08 +0000 Subject: Initial import of lv2plug.in universe. --- gendoc.py | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100755 gendoc.py (limited to 'gendoc.py') diff --git a/gendoc.py b/gendoc.py new file mode 100755 index 0000000..eca6c35 --- /dev/null +++ b/gendoc.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +import os +import shutil +import subprocess +import glob +import re +import datetime + +out_base = os.path.join('build', 'default', 'doc') + +try: + shutil.rmtree(out_base) +except: + pass + +os.makedirs(out_base) + +URIPREFIX = 'http://lv2plug.in/ns/' +SPECGENDIR = './specgen' + +print '** Generating core documentation' + +lv2_outdir = os.path.join(out_base, 'lv2core') +os.mkdir(lv2_outdir) +shutil.copy('core.lv2/lv2.h', lv2_outdir) +shutil.copy('core.lv2/lv2.ttl', lv2_outdir) +shutil.copy('core.lv2/manifest.ttl', lv2_outdir) +shutil.copy('doc/index.php', lv2_outdir) + +devnull = open(os.devnull, 'w') + +def gendoc(specgen_dir, bundle_dir, ttl_filename, html_filename): + subprocess.call([os.path.join(specgen_dir, 'lv2specgen.py'), + os.path.join(bundle_dir, ttl_filename), + os.path.join(specgen_dir, 'template.html'), + os.path.join(specgen_dir, 'style.css'), + os.path.join(out_base, html_filename), + os.path.join('..', 'doc'), + '-i']) + +gendoc('./lv2specgen', 'core.lv2', 'lv2.ttl', 'lv2core/lv2core.html') + +style = open('./lv2specgen/style.css', 'r') +footer = open('./lv2specgen/footer.html', 'r') + +# Generate main (ontology) documentation and indices +for dir in ['ext', 'extensions']: + print "** Generating %s%s documentation" % (URIPREFIX, dir) + + outdir = os.path.join(out_base, dir) + + shutil.copytree(dir, outdir, ignore = lambda src, names: '.svn') + os.mkdir(os.path.join(outdir, 'releases')) + + index_html = """ + + + + +LV2 Extensions + +

LV2 Extensions

+

""" + URIPREFIX + dir + "/

\n' + index_html += '
Releases
\n' + + index_html += '' + + index_html += '\n' + + index_file = open(os.path.join(outdir, 'index.html'), 'w') + print >>index_file, index_html + index_file.close() + +# Generate code (headers) documentation +print "** Generating header documentation" +#shutil.copy('Doxyfile', os.path.join('upload', 'Doxyfile')) +print ' * Calling doxygen in ' + os.getcwd() +subprocess.call('doxygen', stdout=devnull) + +devnull.close() +style.close() +footer.close() -- cgit v1.2.1