Skip to content

Commit f95ec95

Browse files
author
Cruz Monrreal
authored
Merge pull request #9742 from naveenkaje/mcuxpresso_export_fix
tools: export: MCUXpresso: fix case inconsistencies in .templ file names
2 parents 3a301cd + 8d284cb commit f95ec95

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/export/mcuxpresso/__init__.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
mbed SDK
3-
Copyright (c) 2011-2016 ARM Limited
3+
Copyright (c) 2011-2019 ARM Limited
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -28,9 +28,10 @@
2828
import copy
2929
import tempfile
3030
import shutil
31+
import re
3132

3233
from subprocess import Popen, PIPE
33-
from os import getcwd, remove
34+
from os import getcwd, remove, listdir
3435
from os.path import splitext, basename, exists
3536
from random import randint
3637

@@ -54,10 +55,19 @@ class MCUXpresso(GNUARMEclipse):
5455

5556
MBED_CONFIG_HEADER_SUPPORTED = True
5657

58+
@staticmethod
59+
def is_target_name_in_dir(path, target_name):
60+
# toos/export/mcuxpresso/ has entries with
61+
# both lower and upper case. Handle these inconsistencies.
62+
for entry in listdir(path):
63+
if(re.match(entry, target_name + '_cproject.tmpl', re.IGNORECASE)):
64+
return True
65+
return False
66+
5767
@classmethod
5868
def is_target_supported(cls, target_name):
5969
# target is supported when *_cproject.tmpl template file exists
60-
if exists(cls.TEMPLATE_DIR + '/mcuxpresso/' + target_name + '_cproject.tmpl'):
70+
if MCUXpresso.is_target_name_in_dir(cls.TEMPLATE_DIR + '/mcuxpresso/', target_name):
6171
target = TARGET_MAP[target_name]
6272
return apply_supported_whitelist(
6373
cls.TOOLCHAIN, POST_BINARY_WHITELIST, target)

0 commit comments

Comments
 (0)