aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-31 02:29:51 +0000
committerDavid Robillard <d@drobilla.net>2013-12-31 02:29:51 +0000
commit3664a975933163639a54f8ba35a7fc2c0dae6034 (patch)
tree0f646fd9b2fd3c6f2552529805f650dec13887d9
parent7ea2b2bf56cfd5c4c8abfe8674ccda3c7e179132 (diff)
downloadlv2-3664a975933163639a54f8ba35a7fc2c0dae6034.tar.xz
Install lv2specgen for use by other projects.
-rw-r--r--lv2/lv2plug.in/ns/meta/meta.ttl2
-rwxr-xr-xlv2specgen/lv2specgen.py71
-rw-r--r--lv2specgen/template.html5
-rw-r--r--wscript11
4 files changed, 52 insertions, 37 deletions
diff --git a/lv2/lv2plug.in/ns/meta/meta.ttl b/lv2/lv2plug.in/ns/meta/meta.ttl
index a88345d..b13349e 100644
--- a/lv2/lv2plug.in/ns/meta/meta.ttl
+++ b/lv2/lv2plug.in/ns/meta/meta.ttl
@@ -56,6 +56,8 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R
rdfs:label "Add scope example plugin from Robin Gareus."
] , [
rdfs:label "lv2specgen: Fix links to externally defined terms."
+ ] , [
+ rdfs:label "Install lv2specgen for use by other projects."
]
]
] , [
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 4ea301a..b33233c 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -41,6 +41,7 @@ __license__ = "MIT License <http://www.opensource.org/licenses/mit>"
__contact__ = "devel@lists.lv2plug.in"
import datetime
+import optparse
import os
import re
import sys
@@ -1045,7 +1046,7 @@ def load_tags(path, docdir):
return linkmap
-def specgen(specloc, indir, style_uri, docdir, tags, instances=False, offline=False):
+def specgen(specloc, indir, style_uri, docdir, tags, opts, instances=False, offline=False):
"""The meat and potatoes: Everything starts here."""
global spec_url
@@ -1151,9 +1152,17 @@ def specgen(specloc, indir, style_uri, docdir, tags, instances=False, offline=Fa
template = template.replace('@REFERENCE@', termlist)
template = template.replace('@FILENAME@', filename)
template = template.replace('@HEADER@', basename + '.h')
- template = template.replace('@MAIL@', 'devel@lists.lv2plug.in')
template = template.replace('@HISTORY@', specHistory(m, spec))
+ mail_row = ''
+ if 'list_email' in opts:
+ mail_row = '<tr><th>Discuss</th><td><a href="mailto:%s">%s</a>' % (
+ opts['list_email'], opts['list_email'])
+ if 'list_page' in opts:
+ mail_row += ' <a href="%s">(subscribe)</a>' % opts['list_page']
+ mail_row += '</td></tr>'
+ template = template.replace('@MAIL@', mail_row)
+
version = specVersion(m, spec) # (minor, micro, date)
date_string = version[2]
if date_string == "":
@@ -1250,7 +1259,7 @@ def getOntologyNS(m):
def usage():
script = os.path.basename(sys.argv[0])
- print("""Usage: %s ONTOLOGY INDIR STYLE OUTPUT [DOCDIR TAGS] [FLAGS]
+ return """Usage: %s ONTOLOGY INDIR STYLE OUTPUT [DOCDIR TAGS] [FLAGS]
ONTOLOGY : Path to ontology file
INDIR : Input directory containing template.html and style.css
@@ -1265,38 +1274,34 @@ def usage():
Example:
%s lv2_foos.ttl template.html style.css lv2_foos.html ../doc -i -p foos
-""" % (script, script))
- sys.exit(-1)
-
+""" % (script, script)
if __name__ == "__main__":
"""Ontology specification generator tool"""
- args = sys.argv[1:]
+ opt = optparse.OptionParser(usage=usage(),
+ description='Write HTML documentation for an RDF ontology.')
+ opt.add_option('--list-email', type='string', dest='list_email')
+ opt.add_option('--list-page', type='string', dest='list_page')
+ opt.add_option('-i', action='store_true', dest='instances')
+ opt.add_option('-p', type='string', dest='prefix')
+
+ (options, args) = opt.parse_args()
+ opts = vars(options)
+
if (len(args) < 3):
- usage()
- else:
- ontology = "file:" + str(args[0])
- indir = args[1]
- style = args[2]
- output = args[3]
- docdir = None
- tags = None
- if len(args) > 5:
- docdir = args[4]
- tags = args[5]
-
- # Flags
- instances = False
- if len(args) > 6:
- flags = args[6:]
- i = 0
- while i < len(flags):
- if flags[i] == '-i':
- instances = True
- elif flags[i] == '-p':
- spec_pre = flags[i + 1]
- i += 1
- i += 1
-
- save(output, specgen(ontology, indir, style, docdir, tags, instances=instances))
+ print(usage())
+ sys.exit(-1)
+
+ spec_pre = options.prefix
+ ontology = "file:" + str(args[0])
+ indir = args[1]
+ style = args[2]
+ output = args[3]
+ docdir = None
+ tags = None
+ if len(args) > 5:
+ docdir = args[4]
+ tags = args[5]
+
+ save(output, specgen(ontology, indir, style, docdir, tags, opts, instances=options.instances))
diff --git a/lv2specgen/template.html b/lv2specgen/template.html
index 691f6fd..f2aaeee 100644
--- a/lv2specgen/template.html
+++ b/lv2specgen/template.html
@@ -24,10 +24,7 @@
<tr><th>URI</th><td><a href="@URI@">@URI@</a></td></tr>
<tr><th>Version</th><td>@REVISION@</td></tr>
<tr><th>Prefixes</th><td>@PREFIXES@</td></tr>
- <tr><th>Discuss</th><td>
- <a href="mailto:@MAIL@">@MAIL@</a>
- (<a href="http://lists.lv2plug.in/listinfo.cgi/devel-lv2plug.in">subscribe</a>)
- </td></tr>
+ @MAIL@
@AUTHORS@
</table>
</div>
diff --git a/wscript b/wscript
index 0981303..dad6740 100644
--- a/wscript
+++ b/wscript
@@ -11,6 +11,7 @@ import waflib.Context as Context
import waflib.Logs as Logs
import waflib.Options as Options
import waflib.Scripting as Scripting
+import waflib.Utils as Utils
# Variables for 'waf dist'
APPNAME = 'lv2'
@@ -169,6 +170,8 @@ def specgen(task):
os.path.relpath(STYLEPATH, bundle),
os.path.relpath('build/doc/html', bundle),
TAGFILE,
+ { 'list_email': 'devel@lists.lv2plug.in',
+ 'list_page': 'http://lists.lv2plug.in/listinfo.cgi/devel-lv2plug.in' },
instances=True,
offline=(not task.env.ONLINE_DOCS))
@@ -318,6 +321,14 @@ def build(bld):
if bld.env.BUILD_BOOK:
bld.recurse('plugins')
+ # Install lv2specgen
+ bld.install_files('${DATADIR}/lv2specgen/',
+ ['lv2specgen/style.css',
+ 'lv2specgen/template.html'])
+ bld.install_files('${DATADIR}/lv2specgen/DTD/',
+ bld.path.ant_glob('lv2specgen/DTD/*'))
+ bld.install_files('${BINDIR}', 'lv2specgen/lv2specgen.py', chmod=Utils.O755)
+
if bld.env.DOCS or bld.env.ONLINE_DOCS:
# Build Doxygen documentation (and tags file)
autowaf.build_dox(bld, 'LV2', VERSION, top, out, 'lv2plug.in/doc', False)