diff --git a/tools/build.py b/tools/build.py index 66f94fe0b0..7915ed03a4 100644 --- a/tools/build.py +++ b/tools/build.py @@ -214,11 +214,10 @@ if __name__ == '__main__': if options.cppcheck_validation: for toolchain in toolchains: if not TOOLCHAIN_CLASSES[toolchain].check_executable(): - if TOOLCHAIN_PATHS[toolchain] == '': - TOOLCHAIN_PATHS[toolchain] = "No path set" + search_path = TOOLCHAIN_PATHS[toolchain] or "No path set" args_error(parser, "Could not find executable for %s.\n" "Currently set search path: %s" - % (toolchain, TOOLCHAIN_PATHS[toolchain])) + % (toolchain, search_path)) for target in targets: try: mcu = TARGET_MAP[target] diff --git a/tools/make.py b/tools/make.py index 556b914487..e8d5a06d8b 100644 --- a/tools/make.py +++ b/tools/make.py @@ -233,11 +233,10 @@ if __name__ == '__main__': notify = None if not TOOLCHAIN_CLASSES[toolchain].check_executable(): - if TOOLCHAIN_PATHS[toolchain] == '': - TOOLCHAIN_PATHS[toolchain] = "No path set" + search_path = TOOLCHAIN_PATHS[toolchain] or "No path set" args_error(parser, "Could not find executable for %s.\n" "Currently set search path: %s" - %(toolchain,TOOLCHAIN_PATHS[toolchain])) + %(toolchain,search_path)) # Test for test_no in p: diff --git a/tools/test.py b/tools/test.py index 491139d35b..5b8f9d97a3 100644 --- a/tools/test.py +++ b/tools/test.py @@ -116,11 +116,10 @@ if __name__ == '__main__': toolchain = options.tool[0] if not TOOLCHAIN_CLASSES[toolchain].check_executable(): - if TOOLCHAIN_PATHS[toolchain] == '': - TOOLCHAIN_PATHS[toolchain] = "No path set" + search_path = TOOLCHAIN_PATHS[toolchain] or "No path set" args_error(parser, "Could not find executable for %s.\n" "Currently set search path: %s" - % (toolchain, TOOLCHAIN_PATHS[toolchain])) + % (toolchain, search_path)) # Find all tests in the relevant paths for path in all_paths: diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 407d5374d5..26f6441833 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -44,6 +44,9 @@ class ARM(mbedToolchain): @staticmethod def check_executable(): + """Returns True if the executable (armcc) location specified by the + user exists OR the executable can be found on the PATH. + Returns False otherwise.""" if not TOOLCHAIN_PATHS["ARM"] or not exists(TOOLCHAIN_PATHS['ARM']): exe = find_executable('armcc') if not exe: diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index c66b7c45c7..fc54c25dae 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -272,6 +272,9 @@ class GCC(mbedToolchain): class GCC_ARM(GCC): @staticmethod def check_executable(): + """Returns True if the executable (arm-none-eabi-gcc) location + specified by the user exists OR the executable can be found on the PATH. + Returns False otherwise.""" if not TOOLCHAIN_PATHS["GCC_ARM"] or not exists(TOOLCHAIN_PATHS['GCC_ARM']): exe = find_executable('arm-none-eabi-gcc') if not exe: @@ -306,6 +309,9 @@ class GCC_ARM(GCC): class GCC_CR(GCC): @staticmethod def check_executable(): + """Returns True if the executable (arm-none-eabi-gcc) location + specified by the user exists OR the executable can be found on the PATH. + Returns False otherwise.""" if not TOOLCHAIN_PATHS["GCC_CR"] or not exists(TOOLCHAIN_PATHS['GCC_CR']): exe = find_executable('arm-none-eabi-gcc') if not exe: diff --git a/tools/toolchains/iar.py b/tools/toolchains/iar.py index fc7047b080..01ac99846d 100644 --- a/tools/toolchains/iar.py +++ b/tools/toolchains/iar.py @@ -47,6 +47,9 @@ class IAR(mbedToolchain): @staticmethod def check_executable(): + """Returns True if the executable (arm-none-eabi-gcc) location + specified by the user exists OR the executable can be found on the PATH. + Returns False otherwise.""" if not TOOLCHAIN_PATHS["IAR"] or not exists(TOOLCHAIN_PATHS['IAR']): exe = find_executable('iccarm') if not exe: