Skip to content

Commit 176b750

Browse files
author
Naveen Kaje
committed
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.
1 parent c07410d commit 176b750

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,12 @@ def argparse_profile_filestring_type(string):
495495
absolute path or a file name (expanded to
496496
mbed-os/tools/profiles/<fname>.json) of a existing file"""
497497
fpath = join(dirname(__file__), "profiles/{}.json".format(string))
498-
if exists(string):
499-
return string
500-
elif exists(fpath):
498+
499+
# default profiles are searched first, local ones next.
500+
if exists(fpath):
501501
return fpath
502+
elif exists(string):
503+
return string
502504
else:
503505
raise argparse.ArgumentTypeError(
504506
"{0} does not exist in the filesystem.".format(string))

0 commit comments

Comments
 (0)