summaryrefslogtreecommitdiffstats
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:47:10 +0100
commit2e388048b61f6029bae1913cbb546ac40b9cfe51 (patch)
tree8fa0fc951caab1430636fca971c27a7e7beb45ce /scripts/contrib
parent79be110c1fdfd0affe6a310b96e7107c4549d23c (diff)
downloadpoky-2e388048b61f6029bae1913cbb546ac40b9cfe51.tar.gz
scripts: python3: Use print function
Used print function instead of print statement to make the code work in python 3. (From OE-Core rev: 80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0) 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
24import re 24import re
25 25
26def usage(): 26def usage():
27 print 'Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0]) 27 print('Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0]))
28 print ' -d FILENAME documentation file to search' 28 print(' -d FILENAME documentation file to search')
29 print ' -h, --help display this help and exit' 29 print(' -h, --help display this help and exit')
30 print ' -m METADIR meta directory to search for recipes' 30 print(' -m METADIR meta directory to search for recipes')
31 print ' -t FILENAME documentation config file (for doc tags)' 31 print(' -t FILENAME documentation config file (for doc tags)')
32 print ' -T Only display variables with doc tags (requires -t)' 32 print(' -T Only display variables with doc tags (requires -t)')
33 33
34def recipe_bbvars(recipe): 34def recipe_bbvars(recipe):
35 ''' Return a unique set of every bbvar encountered in the recipe ''' 35 ''' Return a unique set of every bbvar encountered in the recipe '''
@@ -38,8 +38,8 @@ def recipe_bbvars(recipe):
38 try: 38 try:
39 r = open(recipe) 39 r = open(recipe)
40 except IOError as (errno, strerror): 40 except IOError as (errno, strerror):
41 print 'WARNING: Failed to open recipe ', recipe 41 print('WARNING: Failed to open recipe ', recipe)
42 print strerror 42 print(strerror)
43 43
44 for line in r: 44 for line in r:
45 # Strip any comments from the line 45 # Strip any comments from the line
@@ -72,8 +72,8 @@ def bbvar_is_documented(var, docfiles):
72 try: 72 try:
73 f = open(doc) 73 f = open(doc)
74 except IOError as (errno, strerror): 74 except IOError as (errno, strerror):
75 print 'WARNING: Failed to open doc ', doc 75 print('WARNING: Failed to open doc ', doc)
76 print strerror 76 print(strerror)
77 for line in f: 77 for line in f:
78 if prog.match(line): 78 if prog.match(line):
79 return True 79 return True
@@ -110,7 +110,7 @@ def main():
110 try: 110 try:
111 opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"]) 111 opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"])
112 except getopt.GetoptError, err: 112 except getopt.GetoptError, err:
113 print '%s' % str(err) 113 print('%s' % str(err))
114 usage() 114 usage()
115 sys.exit(2) 115 sys.exit(2)
116 116
@@ -122,13 +122,13 @@ def main():
122 if os.path.isfile(a): 122 if os.path.isfile(a):
123 docfiles.append(a) 123 docfiles.append(a)
124 else: 124 else:
125 print 'ERROR: documentation file %s is not a regular file' % (a) 125 print('ERROR: documentation file %s is not a regular file' % a)
126 sys.exit(3) 126 sys.exit(3)
127 elif o == '-m': 127 elif o == '-m':
128 if os.path.isdir(a): 128 if os.path.isdir(a):
129 metadirs.append(a) 129 metadirs.append(a)
130 else: 130 else:
131 print 'ERROR: meta directory %s is not a directory' % (a) 131 print('ERROR: meta directory %s is not a directory' % a)
132 sys.exit(4) 132 sys.exit(4)
133 elif o == "-t": 133 elif o == "-t":
134 if os.path.isfile(a): 134 if os.path.isfile(a):
@@ -139,17 +139,17 @@ def main():
139 assert False, "unhandled option" 139 assert False, "unhandled option"
140 140
141 if len(docfiles) == 0: 141 if len(docfiles) == 0:
142 print 'ERROR: no docfile specified' 142 print('ERROR: no docfile specified')
143 usage() 143 usage()
144 sys.exit(5) 144 sys.exit(5)
145 145
146 if len(metadirs) == 0: 146 if len(metadirs) == 0:
147 print 'ERROR: no metadir specified' 147 print('ERROR: no metadir specified')
148 usage() 148 usage()
149 sys.exit(6) 149 sys.exit(6)
150 150
151 if onlydoctags and docconf == "": 151 if onlydoctags and docconf == "":
152 print 'ERROR: no docconf specified' 152 print('ERROR: no docconf specified')
153 usage() 153 usage()
154 sys.exit(7) 154 sys.exit(7)
155 155
@@ -172,14 +172,14 @@ def main():
172 varlen = varlen + 1 172 varlen = varlen + 1
173 173
174 # Report all undocumented variables 174 # Report all undocumented variables
175 print 'Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars)) 175 print('Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars)))
176 header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7)) 176 header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7))
177 print header 177 print(header)
178 print str("").ljust(len(header), '=') 178 print(str("").ljust(len(header), '='))
179 for v in undocumented: 179 for v in undocumented:
180 doctag = bbvar_doctag(v, docconf) 180 doctag = bbvar_doctag(v, docconf)
181 if not onlydoctags or not doctag == "": 181 if not onlydoctags or not doctag == "":
182 print '%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag) 182 print('%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag))
183 183
184 184
185if __name__ == "__main__": 185if __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):
104 pkgname_len += 1 104 pkgname_len += 1
105 105
106 header = '%-*s%s' % (pkgname_len, str("RECIPE NAME"), str("PACKAGECONFIG FLAGS")) 106 header = '%-*s%s' % (pkgname_len, str("RECIPE NAME"), str("PACKAGECONFIG FLAGS"))
107 print header 107 print(header)
108 print str("").ljust(len(header), '=') 108 print(str("").ljust(len(header), '='))
109 for pkgname in sorted(pkg_dict): 109 for pkgname in sorted(pkg_dict):
110 print('%-*s%s' % (pkgname_len, pkgname, ' '.join(pkg_dict[pkgname]))) 110 print('%-*s%s' % (pkgname_len, pkgname, ' '.join(pkg_dict[pkgname])))
111 111
@@ -115,18 +115,18 @@ def display_flags(flag_dict):
115 flag_len = len("PACKAGECONFIG FLAG") + 5 115 flag_len = len("PACKAGECONFIG FLAG") + 5
116 116
117 header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("RECIPE NAMES")) 117 header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("RECIPE NAMES"))
118 print header 118 print(header)
119 print str("").ljust(len(header), '=') 119 print(str("").ljust(len(header), '='))
120 120
121 for flag in sorted(flag_dict): 121 for flag in sorted(flag_dict):
122 print('%-*s%s' % (flag_len, flag, ' '.join(sorted(flag_dict[flag])))) 122 print('%-*s%s' % (flag_len, flag, ' '.join(sorted(flag_dict[flag]))))
123 123
124def display_all(data_dict): 124def display_all(data_dict):
125 ''' Display all pkgs and PACKAGECONFIG information ''' 125 ''' Display all pkgs and PACKAGECONFIG information '''
126 print str("").ljust(50, '=') 126 print(str("").ljust(50, '='))
127 for fn in data_dict: 127 for fn in data_dict:
128 print('%s' % data_dict[fn].getVar("P", True)) 128 print('%s' % data_dict[fn].getVar("P", True))
129 print fn 129 print(fn)
130 packageconfig = data_dict[fn].getVar("PACKAGECONFIG", True) or '' 130 packageconfig = data_dict[fn].getVar("PACKAGECONFIG", True) or ''
131 if packageconfig.strip() == '': 131 if packageconfig.strip() == '':
132 packageconfig = 'None' 132 packageconfig = 'None'
@@ -136,7 +136,7 @@ def display_all(data_dict):
136 if flag == "doc": 136 if flag == "doc":
137 continue 137 continue
138 print('PACKAGECONFIG[%s] %s' % (flag, flag_val)) 138 print('PACKAGECONFIG[%s] %s' % (flag, flag_val))
139 print '' 139 print('')
140 140
141def main(): 141def main():
142 pkg_dict = {} 142 pkg_dict = {}