summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorVasilij Schneidermann <v.schneidermann@gmail.com>2015-06-04 16:10:53 +0200
committerVasilij Schneidermann <v.schneidermann@gmail.com>2015-06-04 16:10:53 +0200
commit080266ac041ee4589f5c14574447ff95c7ad17f2 (patch)
treecda9ad3d6d6bab90100f28b2b52c517c3e48a49a /doc
parent9800f61b9a5727184ef26d4cd1c5664d8b5da2b0 (diff)
Make script compatible with both Python 2 and 3
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/manual-src/en/mkapiref.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/doc/manual-src/en/mkapiref.py b/doc/manual-src/en/mkapiref.py
index 719751be..11bbc89d 100755
--- a/doc/manual-src/en/mkapiref.py
+++ b/doc/manual-src/en/mkapiref.py
@@ -32,6 +32,7 @@
# files in the program, then also delete it here.
#
# Generates API reference from C++ source code.
+from __future__ import print_function
import re, sys, argparse
class FunctionDoc:
@@ -41,10 +42,10 @@ class FunctionDoc:
self.domain = domain
def write(self, out):
- print '''.. {}:: {}'''.format(self.domain, self.name)
- print ''
+ print('''.. {}:: {}'''.format(self.domain, self.name))
+ print()
for line in self.content:
- print ' {}'.format(line)
+ print(' {}'.format(line))
class TypedefDoc:
def __init__(self, name, content):
@@ -52,10 +53,10 @@ class TypedefDoc:
self.content = content
def write(self, out):
- print '''.. type:: {}'''.format(self.name)
- print ''
+ print('''.. type:: {}'''.format(self.name))
+ print()
for line in self.content:
- print ' {}'.format(line)
+ print(' {}'.format(line))
class StructDoc:
def __init__(self, name, content, domain, members, member_domain):
@@ -67,19 +68,19 @@ class StructDoc:
def write(self, out):
if self.name:
- print '''.. {}:: {}'''.format(self.domain, self.name)
- print ''
+ print('''.. {}:: {}'''.format(self.domain, self.name))
+ print()
for line in self.content:
- print ' {}'.format(line)
- print ''
+ print(' {}'.format(line))
+ print()
for name, content in self.members:
- print ''' .. {}:: {}'''.format(\
+ print(''' .. {}:: {}'''.format(\
'function' if name.endswith(')') else self.member_domain,
- name)
- print ''
+ name))
+ print()
for line in content:
- print ''' {}'''.format(line)
- print ''
+ print(''' {}'''.format(line))
+ print()
class MacroDoc:
def __init__(self, name, content):
@@ -87,10 +88,10 @@ class MacroDoc:
self.content = content
def write(self, out):
- print '''.. macro:: {}'''.format(self.name)
- print ''
+ print('''.. macro:: {}'''.format(self.name))
+ print()
for line in self.content:
- print ' {}'.format(line)
+ print(' {}'.format(line))
def make_api_ref(infiles):
macros = []
@@ -124,12 +125,12 @@ def make_api_ref(infiles):
for title, docs in alldocs:
if not docs:
continue
- print title
- print '-'*len(title)
+ print(title)
+ print('-'*len(title))
for doc in docs:
doc.write(sys.stdout)
- print ''
- print ''
+ print()
+ print()
def process_macro(infile):
content = read_content(infile)
@@ -263,6 +264,6 @@ if __name__ == '__main__':
help='source file')
args = parser.parse_args()
if args.header:
- print args.header.read()
+ print(args.header.read())
for infile in args.files:
make_api_ref(args.files)