Skip to content

Commit f45b53f

Browse files
committed
Ignore non-config json files
1 parent db30e71 commit f45b53f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tools/resources/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,17 @@
8080
'ARMC6': 'ARMC6',
8181
}
8282

83+
MBED_LIB_FILENAME = 'mbed_lib.json'
84+
MBED_APP_FILENAME = 'mbed_app.json'
85+
CONFIG_FILES = set([
86+
MBED_LIB_FILENAME,
87+
MBED_APP_FILENAME
88+
])
89+
8390

8491
FileRef = namedtuple("FileRef", "name path")
8592

93+
8694
class FileType(object):
8795
C_SRC = "c"
8896
CPP_SRC = "c++"
@@ -280,13 +288,17 @@ def get_file_refs(self, file_type):
280288
if self._include_file(ref)
281289
]
282290

283-
def filter_by_libraries(self, library_refs):
291+
def filter_by_libraries(self, libraries_included):
284292
"""
285293
Call after completely done scanning to filter resources based on
286294
libraries
287295
"""
288-
self._libs_filtered = library_refs
289-
self._excluded_libs = set(self._file_refs[FileType.JSON]) - set(library_refs)
296+
self._libs_filtered = set(libraries_included)
297+
all_library_refs = set(
298+
ref for ref in self._file_refs[FileType.JSON]
299+
if ref.name.endswith(MBED_LIB_FILENAME)
300+
)
301+
self._excluded_libs = all_library_refs - self._libs_filtered
290302

291303
def _get_from_refs(self, file_type, key):
292304
return sorted([key(f) for f in self.get_file_refs(file_type)])

0 commit comments

Comments
 (0)