|
15 | 15 | limitations under the License. |
16 | 16 | """ |
17 | 17 | import re |
18 | | -from os.path import join, basename, splitext, dirname, exists |
19 | | -from distutils.spawn import find_executable |
| 18 | +from os.path import join, basename, splitext |
20 | 19 |
|
21 | 20 | from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS |
22 | 21 | from tools.hooks import hook_tool |
@@ -275,12 +274,7 @@ def check_executable(): |
275 | 274 | """Returns True if the executable (arm-none-eabi-gcc) location |
276 | 275 | specified by the user exists OR the executable can be found on the PATH. |
277 | 276 | Returns False otherwise.""" |
278 | | - if not TOOLCHAIN_PATHS["GCC_ARM"] or not exists(TOOLCHAIN_PATHS['GCC_ARM']): |
279 | | - exe = find_executable('arm-none-eabi-gcc') |
280 | | - if not exe: |
281 | | - return False |
282 | | - TOOLCHAIN_PATHS['GCC_ARM'] = dirname(exe) |
283 | | - return True |
| 277 | + return mbedToolchain.generic_check_executable("GCC_ARM", 'arm-none-eabi-gcc', 1) |
284 | 278 |
|
285 | 279 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): |
286 | 280 | GCC.__init__(self, target, options, notify, macros, silent, TOOLCHAIN_PATHS['GCC_ARM'], extra_verbose=extra_verbose) |
@@ -312,12 +306,7 @@ def check_executable(): |
312 | 306 | """Returns True if the executable (arm-none-eabi-gcc) location |
313 | 307 | specified by the user exists OR the executable can be found on the PATH. |
314 | 308 | Returns False otherwise.""" |
315 | | - if not TOOLCHAIN_PATHS["GCC_CR"] or not exists(TOOLCHAIN_PATHS['GCC_CR']): |
316 | | - exe = find_executable('arm-none-eabi-gcc') |
317 | | - if not exe: |
318 | | - return False |
319 | | - TOOLCHAIN_PATHS['GCC_CR'] = dirname(exe) |
320 | | - return True |
| 309 | + return mbedToolchain.generic_check_executable("GCC_CR", 'arm-none-eabi-gcc', 1) |
321 | 310 |
|
322 | 311 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): |
323 | 312 | GCC.__init__(self, target, options, notify, macros, silent, TOOLCHAIN_PATHS['GCC_CR'], extra_verbose=extra_verbose) |
|
0 commit comments