Merge pull request #9742 from naveenkaje/mcuxpresso_export_fix

tools: export: MCUXpresso: fix case inconsistencies in .templ file names
pull/9745/head
Cruz Monrreal 2019-02-15 21:15:42 -06:00 committed by GitHub
commit f95ec957dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
Copyright (c) 2011-2019 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -28,9 +28,10 @@ from builtins import str
import copy
import tempfile
import shutil
import re
from subprocess import Popen, PIPE
from os import getcwd, remove
from os import getcwd, remove, listdir
from os.path import splitext, basename, exists
from random import randint
@ -54,10 +55,19 @@ class MCUXpresso(GNUARMEclipse):
MBED_CONFIG_HEADER_SUPPORTED = True
@staticmethod
def is_target_name_in_dir(path, target_name):
# toos/export/mcuxpresso/ has entries with
# both lower and upper case. Handle these inconsistencies.
for entry in listdir(path):
if(re.match(entry, target_name + '_cproject.tmpl', re.IGNORECASE)):
return True
return False
@classmethod
def is_target_supported(cls, target_name):
# target is supported when *_cproject.tmpl template file exists
if exists(cls.TEMPLATE_DIR + '/mcuxpresso/' + target_name + '_cproject.tmpl'):
if MCUXpresso.is_target_name_in_dir(cls.TEMPLATE_DIR + '/mcuxpresso/', target_name):
target = TARGET_MAP[target_name]
return apply_supported_whitelist(
cls.TOOLCHAIN, POST_BINARY_WHITELIST, target)