From 176b7502575bd85077c5101906cdb915544f85db Mon Sep 17 00:00:00 2001 From: Naveen Kaje Date: Thu, 14 Feb 2019 10:17:59 -0600 Subject: [PATCH] tools/utils: ensure default build profiles are processed first The command-line argument '--profile' looks for build profiles provided in mbed-os/tools/profiles/. If a directory name exists in the root folder with the same name as one of the profile names provided by default [e.g debug/develop/release], that directory is processed instead resulting in incorrect behavior. Fix this behavior by processing the default profiles first. --- tools/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index ad5db06fdf..37d6c885f7 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -495,10 +495,12 @@ def argparse_profile_filestring_type(string): absolute path or a file name (expanded to mbed-os/tools/profiles/.json) of a existing file""" fpath = join(dirname(__file__), "profiles/{}.json".format(string)) - if exists(string): - return string - elif exists(fpath): + + # default profiles are searched first, local ones next. + if exists(fpath): return fpath + elif exists(string): + return string else: raise argparse.ArgumentTypeError( "{0} does not exist in the filesystem.".format(string))