1
1
"""
2
2
mbed SDK
3
- Copyright (c) 2011-2016 ARM Limited
3
+ Copyright (c) 2011-2019 ARM Limited
4
4
5
5
Licensed under the Apache License, Version 2.0 (the "License");
6
6
you may not use this file except in compliance with the License.
28
28
import copy
29
29
import tempfile
30
30
import shutil
31
+ import re
31
32
32
33
from subprocess import Popen , PIPE
33
- from os import getcwd , remove
34
+ from os import getcwd , remove , listdir
34
35
from os .path import splitext , basename , exists
35
36
from random import randint
36
37
@@ -54,10 +55,19 @@ class MCUXpresso(GNUARMEclipse):
54
55
55
56
MBED_CONFIG_HEADER_SUPPORTED = True
56
57
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
+
57
67
@classmethod
58
68
def is_target_supported (cls , target_name ):
59
69
# 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 ):
61
71
target = TARGET_MAP [target_name ]
62
72
return apply_supported_whitelist (
63
73
cls .TOOLCHAIN , POST_BINARY_WHITELIST , target )
0 commit comments