upgrade checkJavaDocs.py to python3

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1367071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-07-30 12:49:40 +00:00
parent 3d9e8b745f
commit e101167585
2 changed files with 17 additions and 17 deletions

View File

@ -41,10 +41,10 @@ def checkSummary(fullPath):
desc = desc.strip()
if desc == '':
if not printed:
print
print fullPath
print()
print(fullPath)
printed = True
print ' no package description (missing package.html in src?)'
print(' no package description (missing package.html in src?)')
anyMissing = True
desc = None
else:
@ -52,17 +52,17 @@ def checkSummary(fullPath):
if lineLower in ('<td>&nbsp;</td>', '<td></td>', '<td class="collast">&nbsp;</td>'):
if not printed:
print
print fullPath
print()
print(fullPath)
printed = True
print ' missing: %s' % unescapeHTML(lastHREF)
print(' missing: %s' % unescapeHTML(lastHREF))
anyMissing = True
elif lineLower.find('licensed to the apache software foundation') != -1 or lineLower.find('copyright 2004 the apache software foundation') != -1:
if not printed:
print
print fullPath
print()
print(fullPath)
printed = True
print ' license-is-javadoc: %s' % unescapeHTML(lastHREF)
print(' license-is-javadoc: %s' % unescapeHTML(lastHREF))
anyMissing = True
m = reHREF.search(line)
if m is not None:
@ -85,17 +85,17 @@ def checkPackageSummaries(root, level='class'):
"""
if level != 'class' and level != 'package':
print 'unsupported level: %s, must be "class" or "package"' % level
print('unsupported level: %s, must be "class" or "package"' % level)
sys.exit(1)
#for dirPath, dirNames, fileNames in os.walk('%s/lucene/build/docs/api' % root):
if False:
os.chdir(root)
print
print 'Run "ant javadocs" > javadocs.log...'
print()
print('Run "ant javadocs" > javadocs.log...')
if os.system('ant javadocs > javadocs.log 2>&1'):
print ' FAILED'
print(' FAILED')
sys.exit(1)
anyMissing = False
@ -116,14 +116,14 @@ def checkPackageSummaries(root, level='class'):
if __name__ == '__main__':
if len(sys.argv) < 2 or len(sys.argv) > 3:
print 'usage: %s <dir> [class|package]' % sys.argv[0]
print('usage: %s <dir> [class|package]' % sys.argv[0])
sys.exit(1)
if len(sys.argv) == 2:
level = 'class'
else:
level = sys.argv[2]
if checkPackageSummaries(sys.argv[1], level):
print
print 'Missing javadocs were found!'
print()
print('Missing javadocs were found!')
sys.exit(1)
sys.exit(0)

View File

@ -1701,7 +1701,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<attribute name="dir"/>
<attribute name="level" default="class"/>
<sequential>
<exec dir="." executable="${python.exe}" failonerror="true">
<exec dir="." executable="${python32.exe}" failonerror="true">
<arg value="${dev-tools.dir}/scripts/checkJavaDocs.py"/>
<arg value="@{dir}"/>
<arg value="@{level}"/>