|
@@ -24,12 +24,12 @@ import os.path
|
|
|
import re
|
|
|
|
|
|
def usage():
|
|
|
- print 'Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0])
|
|
|
- print ' -d FILENAME documentation file to search'
|
|
|
- print ' -h, --help display this help and exit'
|
|
|
- print ' -m METADIR meta directory to search for recipes'
|
|
|
- print ' -t FILENAME documentation config file (for doc tags)'
|
|
|
- print ' -T Only display variables with doc tags (requires -t)'
|
|
|
+ print('Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0]))
|
|
|
+ print(' -d FILENAME documentation file to search')
|
|
|
+ print(' -h, --help display this help and exit')
|
|
|
+ print(' -m METADIR meta directory to search for recipes')
|
|
|
+ print(' -t FILENAME documentation config file (for doc tags)')
|
|
|
+ print(' -T Only display variables with doc tags (requires -t)')
|
|
|
|
|
|
def recipe_bbvars(recipe):
|
|
|
''' Return a unique set of every bbvar encountered in the recipe '''
|
|
@@ -38,8 +38,8 @@ def recipe_bbvars(recipe):
|
|
|
try:
|
|
|
r = open(recipe)
|
|
|
except IOError as (errno, strerror):
|
|
|
- print 'WARNING: Failed to open recipe ', recipe
|
|
|
- print strerror
|
|
|
+ print('WARNING: Failed to open recipe ', recipe)
|
|
|
+ print(strerror)
|
|
|
|
|
|
for line in r:
|
|
|
# Strip any comments from the line
|
|
@@ -72,8 +72,8 @@ def bbvar_is_documented(var, docfiles):
|
|
|
try:
|
|
|
f = open(doc)
|
|
|
except IOError as (errno, strerror):
|
|
|
- print 'WARNING: Failed to open doc ', doc
|
|
|
- print strerror
|
|
|
+ print('WARNING: Failed to open doc ', doc)
|
|
|
+ print(strerror)
|
|
|
for line in f:
|
|
|
if prog.match(line):
|
|
|
return True
|
|
@@ -110,7 +110,7 @@ def main():
|
|
|
try:
|
|
|
opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"])
|
|
|
except getopt.GetoptError, err:
|
|
|
- print '%s' % str(err)
|
|
|
+ print('%s' % str(err))
|
|
|
usage()
|
|
|
sys.exit(2)
|
|
|
|
|
@@ -122,13 +122,13 @@ def main():
|
|
|
if os.path.isfile(a):
|
|
|
docfiles.append(a)
|
|
|
else:
|
|
|
- print 'ERROR: documentation file %s is not a regular file' % (a)
|
|
|
+ print('ERROR: documentation file %s is not a regular file' % a)
|
|
|
sys.exit(3)
|
|
|
elif o == '-m':
|
|
|
if os.path.isdir(a):
|
|
|
metadirs.append(a)
|
|
|
else:
|
|
|
- print 'ERROR: meta directory %s is not a directory' % (a)
|
|
|
+ print('ERROR: meta directory %s is not a directory' % a)
|
|
|
sys.exit(4)
|
|
|
elif o == "-t":
|
|
|
if os.path.isfile(a):
|
|
@@ -139,17 +139,17 @@ def main():
|
|
|
assert False, "unhandled option"
|
|
|
|
|
|
if len(docfiles) == 0:
|
|
|
- print 'ERROR: no docfile specified'
|
|
|
+ print('ERROR: no docfile specified')
|
|
|
usage()
|
|
|
sys.exit(5)
|
|
|
|
|
|
if len(metadirs) == 0:
|
|
|
- print 'ERROR: no metadir specified'
|
|
|
+ print('ERROR: no metadir specified')
|
|
|
usage()
|
|
|
sys.exit(6)
|
|
|
|
|
|
if onlydoctags and docconf == "":
|
|
|
- print 'ERROR: no docconf specified'
|
|
|
+ print('ERROR: no docconf specified')
|
|
|
usage()
|
|
|
sys.exit(7)
|
|
|
|
|
@@ -172,14 +172,14 @@ def main():
|
|
|
varlen = varlen + 1
|
|
|
|
|
|
# Report all undocumented variables
|
|
|
- print 'Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars))
|
|
|
+ print('Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars)))
|
|
|
header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7))
|
|
|
- print header
|
|
|
- print str("").ljust(len(header), '=')
|
|
|
+ print(header)
|
|
|
+ print(str("").ljust(len(header), '='))
|
|
|
for v in undocumented:
|
|
|
doctag = bbvar_doctag(v, docconf)
|
|
|
if not onlydoctags or not doctag == "":
|
|
|
- print '%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag)
|
|
|
+ print('%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag))
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|