From: Martin Ling Date: Sun, 14 Sep 2014 04:32:00 +0000 (+0100) Subject: bindings: Make documentation script work under python 3.x. X-Git-Tag: libsigrok-0.4.0~1001 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8fa3fc7c601a058832f21d970e6ede3ae8488141;p=libsigrok.git bindings: Make documentation script work under python 3.x. --- diff --git a/bindings/swig/doc.py b/bindings/swig/doc.py index 10b0494e..4987b6ce 100644 --- a/bindings/swig/doc.py +++ b/bindings/swig/doc.py @@ -17,6 +17,7 @@ ## along with this program. If not, see . ## +from __future__ import print_function from xml.etree import ElementTree import sys, os @@ -40,10 +41,10 @@ for compound in index.findall('compound'): brief = get_text(cls.find('briefdescription')) if brief: if language == 'python': - print '%%feature("docstring") %s "%s";' % (class_name, brief) + print('%%feature("docstring") %s "%s";' % (class_name, brief)) elif language == 'java': - print '%%typemap(javaclassmodifiers) %s "/** %s */\npublic class"' % ( - class_name, brief) + print('%%typemap(javaclassmodifiers) %s "/** %s */\npublic class"' % ( + class_name, brief)) for section in cls.findall('sectiondef'): if section.attrib['kind'] != 'public-func': continue @@ -62,14 +63,14 @@ for compound in index.findall('compound'): parameters[name] = description if brief: if language == 'python': - print str.join('\n', [ + print(str.join('\n', [ '%%feature("docstring") %s::%s "%s' % ( class_name, function_name, brief)] + [ '@param %s %s' % (name, desc) - for name, desc in parameters.items()]) + '";' + for name, desc in parameters.items()]) + '";') elif language == 'java': - print str.join('\n', [ + print(str.join('\n', [ '%%javamethodmodifiers %s::%s "/** %s' % ( class_name, function_name, brief)] + [ ' * @param %s %s' % (name, desc) - for name, desc in parameters.items()]) + ' */\npublic"' + for name, desc in parameters.items()]) + ' */\npublic"')