diff options
Diffstat (limited to 'scripts/contrib')
| -rwxr-xr-x | scripts/contrib/bbvars.py | 40 | ||||
| -rwxr-xr-x | scripts/contrib/list-packageconfig-flags.py | 14 | 
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 | |||
| 24 | import re | 24 | import re | 
| 25 | 25 | ||
| 26 | def usage(): | 26 | def 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 | ||
| 34 | def recipe_bbvars(recipe): | 34 | def 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 | ||
| 185 | if __name__ == "__main__": | 185 | 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): | |||
| 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 | ||
| 124 | def display_all(data_dict): | 124 | def 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 | ||
| 141 | def main(): | 141 | def main(): | 
| 142 | pkg_dict = {} | 142 | pkg_dict = {} | 
