Docstrings. Empty executable search path handling.

pull/2675/head
Sarah Marsh 2016-09-13 12:06:01 -05:00
parent 61dee45dca
commit 8b74c5b3c7
6 changed files with 18 additions and 9 deletions

View File

@ -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]

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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: