Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ENH: Sync python scripts with python3.

Fix failing ITK*InDoxygenGroup tests due to
python API changes from python2.x to
python3.x.
  • Loading branch information...
commit ae94983bf50a2ef81c9fa67cf162bed977d5a4b4 1 parent 9e1d594
Xiaoxiao Liu XiaoxiaoLiu authored

Showing 1 changed file with 15 additions and 10 deletions. Show diff stats Hide diff stats

  1. +15 10 Utilities/Doxygen/mcdoc.py
25 Utilities/Doxygen/mcdoc.py
... ... @@ -1,10 +1,15 @@
1 1 #!/usr/bin/env python
2 2
3   -import sys, os, re, glob, cStringIO
  3 +import sys, os, re, glob
  4 +try:
  5 + import io
  6 +except ImportError:
  7 + import cStringIO as io
  8 +
4 9
5 10
6 11 def usage():
7   - print >> sys.stderr, """usage: mdoc.py set group file [files...]
  12 + sys.stdout.write( """usage: mdoc.py set group file [files...]
8 13 Add the tag "\\ingroup group" to all the doxygen comment with a \\class
9 14 tag in it.
10 15
@@ -21,12 +26,12 @@ def usage():
21 26 usage: mdoc.py massive-check [ITK-source]
22 27 Check that all the headers in ITK have their module name in their \\ingroup tag.
23 28 As for 'check', a warning is displayed if the tag is missing and 1 is returned.
24   -"""
  29 +\n""")
25 30
26 31 def setGroup( fname, group ):
27   -# print >> sys.stderr, "Processing", fname
  32 +# sys.stderr.write("Processing "+ fname +"\n")
28 33 f = open( fname, "r" )
29   - out = cStringIO.StringIO()
  34 + out = io.StringIO()
30 35 # load everything in memory
31 36 fcontent = f.read()
32 37 f.close()
@@ -64,7 +69,7 @@ def setGroup( fname, group ):
64 69 f.close()
65 70
66 71 def checkGroup( fname, group ):
67   -# print >> sys.stderr, "Checking", fname
  72 +# sys.stderr.write("Checking"+ fname + "\n")
68 73 f = open( fname, "r" )
69 74 # load everything in memory
70 75 fcontent = f.read()
@@ -80,7 +85,7 @@ def checkGroup( fname, group ):
80 85 # get class name and the line for debug output
81 86 cname = re.search(r"\class +([^ ]*)", dcontent).group(1).strip()
82 87 line = len(fcontent[:m.start(1)].splitlines())
83   - print >> sys.stderr, r'%s:%s: error: "\ingroup %s" not set in class %s.' % (fname, line, group, cname)
  88 + sys.stderr.write(r'%s:%s: error: "\ingroup %s" not set in class %s.' % (fname, line, group, cname) +"\n")
84 89 ret = 1
85 90 return ret
86 91
@@ -135,7 +140,7 @@ def main():
135 140 else:
136 141 count += 1
137 142 ret = max( ret, checkGroup(fname, module) )
138   - print >> sys.stderr, count, "headers checked."
  143 + sys.stderr.write(str(count)+" headers checked."+"\n")
139 144 return ret
140 145
141 146 elif command == "massive-check":
@@ -158,11 +163,11 @@ def main():
158 163 for fname2 in glob.glob(dname+"/include/*.h"):
159 164 count += 1
160 165 ret = max( ret, checkGroup(fname2, module) )
161   - print >> sys.stderr, count, "headers checked."
  166 + sys.stderr.write(str(count) + " headers checked."+"\n")
162 167 return ret
163 168
164 169 else:
165   - print >> sys.stderr, "Unknown command", command
  170 + sys.stderr.write("Unknown command" + command +"\n")
166 171 usage()
167 172 return 1
168 173

0 comments on commit ae94983

Please sign in to comment.
Something went wrong with that request. Please try again.