X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=tools%2Fgenboardscfg.py;h=4f6382bc7ca92c0b80f353537d34fe47f844c3ff;hb=2b63959e30f23ef3088dbed6626341c6d8371a66;hp=e9a9c11865b998eea443b5d599cb30a4fff114a6;hpb=3bc14098d8fb05b98e01c4abd901f77b55d19331;p=oweals%2Fu-boot.git diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py index e9a9c11865..4f6382bc7c 100755 --- a/tools/genboardscfg.py +++ b/tools/genboardscfg.py @@ -10,8 +10,6 @@ Converter from Kconfig and MAINTAINERS to a board database. Run 'tools/genboardscfg.py' to create a board database. Run 'tools/genboardscfg.py -h' for available options. - -Python 2.6 or later, but not Python 3.x is necessary to run this script. """ import errno @@ -118,12 +116,12 @@ class KconfigScanner: } def __init__(self): - """Scan all the Kconfig files and create a Config object.""" + """Scan all the Kconfig files and create a Kconfig object.""" # Define environment variables referenced from Kconfig os.environ['srctree'] = os.getcwd() os.environ['UBOOTVERSION'] = 'dummy' os.environ['KCONFIG_OBJDIR'] = '' - self._conf = kconfiglib.Config(print_warnings=False) + self._conf = kconfiglib.Kconfig(warn=False) def __del__(self): """Delete a leftover temporary file before exit. @@ -165,11 +163,7 @@ class KconfigScanner: else: f.write(line[colon + 1:]) - warnings = self._conf.load_config(self._tmpfile) - if warnings: - for warning in warnings: - print('%s: %s' % (defconfig, warning)) - + self._conf.load_config(self._tmpfile) try_remove(self._tmpfile) self._tmpfile = None @@ -178,7 +172,7 @@ class KconfigScanner: # Get the value of CONFIG_SYS_ARCH, CONFIG_SYS_CPU, ... etc. # Set '-' if the value is empty. for key, symbol in list(self._SYMBOL_TABLE.items()): - value = self._conf.get_symbol(symbol).get_value() + value = self._conf.syms.get(symbol).str_value if value: params[key] = value else: @@ -407,18 +401,20 @@ def format_and_output(params_list, output): with open(output, 'w', encoding="utf-8") as f: f.write(COMMENT_BLOCK + '\n'.join(output_lines) + '\n') -def gen_boards_cfg(output, jobs=1, force=False): +def gen_boards_cfg(output, jobs=1, force=False, quiet=False): """Generate a board database file. Arguments: output: The name of the output file jobs: The number of jobs to run simultaneously force: Force to generate the output even if it is new + quiet: True to avoid printing a message if nothing needs doing """ check_top_directory() if not force and output_is_new(output): - print("%s is up to date. Nothing to do." % output) + if not quiet: + print("%s is up to date. Nothing to do." % output) sys.exit(0) params_list = scan_defconfigs(jobs) @@ -439,9 +435,11 @@ def main(): help='the number of jobs to run simultaneously') parser.add_option('-o', '--output', default=OUTPUT_FILE, help='output file [default=%s]' % OUTPUT_FILE) + parser.add_option('-q', '--quiet', action="store_true", help='run silently') (options, args) = parser.parse_args() - gen_boards_cfg(options.output, jobs=options.jobs, force=options.force) + gen_boards_cfg(options.output, jobs=options.jobs, force=options.force, + quiet=options.quiet) if __name__ == '__main__': main()