diff options
| -rwxr-xr-x | lv2specgen/lv2docgen.py | 17 | ||||
| -rwxr-xr-x | lv2specgen/lv2specgen.py | 35 | ||||
| -rwxr-xr-x | plugins/literasc.py | 12 | ||||
| -rw-r--r-- | wscript | 23 | 
4 files changed, 42 insertions, 45 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)) diff --git a/plugins/literasc.py b/plugins/literasc.py index f0b8cc4..5c5b80e 100755 --- a/plugins/literasc.py +++ b/plugins/literasc.py @@ -20,7 +20,7 @@ def format_text(text):  def format_code(lang, code):      if code.strip() == '':          return code -     +      head = '[source,%s]' % lang      sep  = '-' * len(head) + '\n'      return head + '\n' + sep + code.strip('\n') + '\n' + sep @@ -49,7 +49,7 @@ def format_c_source(filename, file):                  n_stars += 1              else:                  if n_stars > 1: -                    output += format_code('c', chunk[0:len(chunk)-1]) +                    output += format_code('c', chunk[0:len(chunk) - 1])                      chunk = ''                      in_comment = True                  else: @@ -57,9 +57,9 @@ def format_c_source(filename, file):                  in_comment_start = False          elif in_comment and prev_c == '*' and c == '/':              if n_stars > 1: -                output += format_text(chunk[0:len(chunk)-1]) +                output += format_text(chunk[0:len(chunk) - 1])              else: -                output += format_code('c', '/* ' + chunk[0:len(chunk)-1] + '*/') +                output += format_code('c', '/* ' + chunk[0:len(chunk) - 1] + '*/')              in_comment = False              in_comment_start = False              chunk = '' @@ -115,10 +115,10 @@ def gen(out, filenames):              out.write('\n')          else:              sys.stderr.write("Unknown source format `%s'" % ( -                    filename[filename.find('.'):])) +                filename[filename.find('.'):]))          file.close() -     +  if __name__ == "__main__":      if len(sys.argv) < 2:          sys.stderr.write('Usage: %s FILENAME...\n' % sys.argv[1]) @@ -182,7 +182,8 @@ def build_index(task):              for dist in dists:                  release = m.value(None, doap['file-release'], dist[1])                  if release: -                    entries[dist] += lv2specgen.releaseChangeset(m, release, str(name)) +                    entries[dist] += lv2specgen.releaseChangeset( +                        m, release, str(name))      # Generate history for all post-unification LV2 distributions      history = lv2specgen.specHistoryMarkup(entries) @@ -201,10 +202,10 @@ def build_index(task):          date = datetime.datetime.utcfromtimestamp(now).strftime('%F')      subst_file(task.inputs[0].abspath(), task.outputs[0].abspath(), -               { '@ROWS@': ''.join(rows), -                 '@LV2_VERSION@': VERSION, -                 '@DATE@' : date, -                 '@HISTORY@' : history}) +               {'@ROWS@': ''.join(rows), +                '@LV2_VERSION@': VERSION, +                '@DATE@': date, +                '@HISTORY@': history})  def build_spec(bld, path):      name            = os.path.basename(path) @@ -286,7 +287,8 @@ def build(bld):                         '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) +    bld.install_files('${BINDIR}', 'lv2specgen/lv2specgen.py', +                      chmod=Utils.O755)      # Install schema bundle      bld.install_files('${LV2DIR}/schemas.lv2/', @@ -361,7 +363,7 @@ def build(bld):                     ' ${SRC} ${TGT}')              bld(rule   = cmd, -                source = os.path.join(srcpath, name + '.ttl'), +                source = os.path.join(srcpath, ttl_name),                  target = [html_path, index_file])              # Install documentation @@ -415,10 +417,9 @@ def test(ctx):      "runs unit tests"      autowaf.pre_test(ctx, APPNAME, dirs=['.'])      for i in ctx.path.ant_glob('**/*-test'): -        name = os.path.basename(i.abspath())          os.environ['PATH'] = '.' + os.pathsep + os.getenv('PATH') -        autowaf.run_test( -            ctx, APPNAME, i.path_from(ctx.path.find_node('build')), dirs=['.'], name=i) +        test = i.path_from(ctx.path.find_node('build')) +        autowaf.run_test(ctx, APPNAME, test, dirs=['.'], name=i)      autowaf.post_test(ctx, APPNAME, dirs=['.'])  class Dist(Scripting.Dist): @@ -463,7 +464,7 @@ def posts(ctx):                                     dev_dist = dev_dist)      autowaf.write_posts(entries, -                        { 'Author': 'drobilla' }, +                        {'Author': 'drobilla'},                          os.path.join(out, 'posts'))  def dist(ctx):  |