diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-30 18:14:46 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-01 12:46:46 +0100 |
commit | 80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0 (patch) | |
tree | c21ed55e063e7c77be81bc2f433f3befabbfa8be /scripts/contrib/bbvars.py | |
parent | 98a4c642444a524f547f5d978a28814d20c12354 (diff) | |
download | openembedded-core-80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0.tar.gz openembedded-core-80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0.tar.bz2 openembedded-core-80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0.zip |
scripts: python3: Use print function
Used print function instead of print statement to make
the code work in python 3.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/bbvars.py')
-rwxr-xr-x | scripts/contrib/bbvars.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/scripts/contrib/bbvars.py b/scripts/contrib/bbvars.py index 0896d64445..04f5023969 100755 --- a/scripts/contrib/bbvars.py +++ b/scripts/contrib/bbvars.py @@ -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__": |