aboutsummaryrefslogtreecommitdiffstats
path: root/lv2specgen
diff options
context:
space:
mode:
Diffstat (limited to 'lv2specgen')
-rwxr-xr-xlv2specgen/lv2docgen.py17
-rwxr-xr-xlv2specgen/lv2specgen.py35
2 files changed, 24 insertions, 28 deletions
diff --git a/lv2specgen/lv2docgen.py b/lv2specgen/lv2docgen.py
index 423659e..23a239d 100755
--- a/lv2specgen/lv2docgen.py
+++ b/lv2specgen/lv2docgen.py
@@ -16,16 +16,16 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+import errno
+import os
+import sys
+
__date__ = '2012-03-27'
__version__ = '0.0.0'
__authors__ = 'David Robillard'
__license__ = 'ISC License <http://www.opensource.org/licenses/isc>'
__contact__ = 'devel@lists.lv2plug.in'
-import errno
-import os
-import sys
-
try:
import rdflib
except ImportError:
@@ -47,7 +47,7 @@ def get_doc(model, subject):
if comment:
return '<p class="content">%s</p>' % comment
return ''
-
+
def port_doc(model, port):
name = model.value(port, lv2.name, None)
comment = model.value(port, rdfs.comment, None)
@@ -131,11 +131,8 @@ if __name__ == '__main__':
pass
else:
raise
-
- print 'Writing <%s> documentation to %s' % (plugin, outpath)
+
+ print('Writing <%s> documentation to %s' % (plugin, outpath))
out = open(outpath, 'w')
out.write(html)
out.close()
-
-
-
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index ada5bd8..1435f12 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -30,18 +30,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-__date__ = "2011-10-26"
-__version__ = __date__.replace('-', '.')
-__authors__ = """
-Christopher Schmidt,
-Uldis Bojars,
-Sergio Fernández,
-David Robillard"""
-__license__ = "MIT License <http://www.opensource.org/licenses/mit>"
-__contact__ = "devel@lists.lv2plug.in"
-
import datetime
-import glob
import optparse
import os
import re
@@ -51,6 +40,16 @@ import xml.sax.saxutils
import xml.dom
import xml.dom.minidom
+__date__ = "2011-10-26"
+__version__ = __date__.replace('-', '.')
+__authors__ = """
+Christopher Schmidt,
+Uldis Bojars,
+Sergio Fernández,
+David Robillard"""
+__license__ = "MIT License <http://www.opensource.org/licenses/mit>"
+__contact__ = "devel@lists.lv2plug.in"
+
try:
from lxml import etree
have_lxml = True
@@ -98,7 +97,7 @@ ns_list = {
"http://lv2plug.in/ns/lv2core#" : "lv2",
"http://usefulinc.com/ns/doap#" : "doap",
"http://ontologi.es/doap-changeset#" : "dcs"
- }
+}
rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#')
@@ -457,7 +456,7 @@ def parseCollection(model, node):
def getTermLink(uri, subject=None, predicate=None):
uri = str(uri)
extra = ''
- if subject != None and predicate != None:
+ if subject is not None and predicate is not None:
extra = 'about="%s" rel="%s" resource="%s"' % (str(subject), niceName(str(predicate)), uri)
if (uri.startswith(spec_ns_str)):
return '<a href="#%s" %s>%s</a>' % (uri.replace(spec_ns_str, ""), extra, niceName(uri))
@@ -500,7 +499,7 @@ def rdfsClassInfo(term, m):
onProp = getObject(p)
elif getPredicate(p) == rdfs.comment:
comment = getObject(p)
- if onProp != None:
+ if onProp is not None:
doc += '<tr><th>Restriction on %s</th><td>' % getTermLink(onProp)
prop_str = ''
@@ -530,7 +529,7 @@ def rdfsClassInfo(term, m):
if prop_str != '':
doc += '<table class=\"restriction\">%s</table>\n' % prop_str
- if comment != None:
+ if comment is not None:
doc += "<span>%s</span>\n" % getLiteralString(comment)
doc += '</td></tr>'
@@ -808,7 +807,7 @@ def buildIndex(m, classlist, proplist, instalist=None, filelist=None):
body += '<li>%s</li>' % termLink(m, p)
body += '</ul></td>\n'
- if (instalist != None and len(instalist) > 0):
+ if (instalist is not None and len(instalist) > 0):
head += '<th>Instances</th>'
body += '<td><ul>'
instalist.sort()
@@ -818,7 +817,7 @@ def buildIndex(m, classlist, proplist, instalist=None, filelist=None):
body += '<li><a href="#%s">%s</a></li>' % (anchor, p)
body += '</ul></td>\n'
- if (filelist != None and len(filelist) > 0):
+ if (filelist is not None and len(filelist) > 0):
head += '<th>Files</th>'
body += '<td><ul>'
filelist.sort()
@@ -1030,7 +1029,7 @@ def specVersion(m, subject):
latest_doap_revision = revision
latest_doap_release = getObject(i)
date = ""
- if latest_doap_release != None:
+ if latest_doap_release is not None:
for i in findStatements(m, latest_doap_release, doap.created, None):
date = getLiteralString(getObject(i))