From: Masahiro Yamada Date: Mon, 25 Jul 2016 10:15:28 +0000 (+0900) Subject: tools: moveconfig: make getting all defconfigs into helper function X-Git-Tag: v2016.09-rc2~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=684c306ec4252797c3085defd63eb6d3177fca36;p=platform%2Fkernel%2Fu-boot.git tools: moveconfig: make getting all defconfigs into helper function I want to reuse this routine in the next commit. Signed-off-by: Masahiro Yamada Reviewed-by: Tom Rini --- diff --git a/tools/moveconfig.py b/tools/moveconfig.py index a083714..d0e4b2d 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -266,6 +266,16 @@ def get_make_cmd(): sys.exit('GNU Make not found') return ret[0].rstrip() +def get_all_defconfigs(): + """Get all the defconfig files under the configs/ directory.""" + defconfigs = [] + for (dirpath, dirnames, filenames) in os.walk('configs'): + dirpath = dirpath[len('configs') + 1:] + for filename in fnmatch.filter(filenames, '*_defconfig'): + defconfigs.append(os.path.join(dirpath, filename)) + + return defconfigs + def color_text(color_enabled, color, string): """Return colored string.""" if color_enabled: @@ -1079,12 +1089,7 @@ def move_config(configs, options): sys.exit('%s - defconfig does not exist. Stopping.' % defconfigs[i]) else: - # All the defconfig files to be processed - defconfigs = [] - for (dirpath, dirnames, filenames) in os.walk('configs'): - dirpath = dirpath[len('configs') + 1:] - for filename in fnmatch.filter(filenames, '*_defconfig'): - defconfigs.append(os.path.join(dirpath, filename)) + defconfigs = get_all_defconfigs() progress = Progress(len(defconfigs)) slots = Slots(configs, options, progress, reference_src_dir)