aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-30 18:14:46 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 12:46:46 +0100
commit80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0 (patch)
treec21ed55e063e7c77be81bc2f433f3befabbfa8be /scripts/contrib
parent98a4c642444a524f547f5d978a28814d20c12354 (diff)
downloadopenembedded-core-80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0.tar.gz
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')
-rwxr-xr-xscripts/contrib/bbvars.py40
-rwxr-xr-xscripts/contrib/list-packageconfig-flags.py14
2 files changed, 27 insertions, 27 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__":
diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py
index 2f3b8b06a6..5dfe796c0a 100755
--- a/scripts/contrib/list-packageconfig-flags.py
+++ b/scripts/contrib/list-packageconfig-flags.py
@@ -104,8 +104,8 @@ def display_pkgs(pkg_dict):
pkgname_len += 1
header = '%-*s%s' % (pkgname_len, str("RECIPE NAME"), str("PACKAGECONFIG FLAGS"))
- print header
- print str("").ljust(len(header), '=')
+ print(header)
+ print(str("").ljust(len(header), '='))
for pkgname in sorted(pkg_dict):
print('%-*s%s' % (pkgname_len, pkgname, ' '.join(pkg_dict[pkgname])))
@@ -115,18 +115,18 @@ def display_flags(flag_dict):
flag_len = len("PACKAGECONFIG FLAG") + 5
header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("RECIPE NAMES"))
- print header
- print str("").ljust(len(header), '=')
+ print(header)
+ print(str("").ljust(len(header), '='))
for flag in sorted(flag_dict):
print('%-*s%s' % (flag_len, flag, ' '.join(sorted(flag_dict[flag]))))
def display_all(data_dict):
''' Display all pkgs and PACKAGECONFIG information '''
- print str("").ljust(50, '=')
+ print(str("").ljust(50, '='))
for fn in data_dict:
print('%s' % data_dict[fn].getVar("P", True))
- print fn
+ print(fn)
packageconfig = data_dict[fn].getVar("PACKAGECONFIG", True) or ''
if packageconfig.strip() == '':
packageconfig = 'None'
@@ -136,7 +136,7 @@ def display_all(data_dict):
if flag == "doc":
continue
print('PACKAGECONFIG[%s] %s' % (flag, flag_val))
- print ''
+ print('')
def main():
pkg_dict = {}