From 0265b57d35feb4ec28f3cbb60342f90233c93bee Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 31 Jan 2019 11:31:33 -0600 Subject: [PATCH] Rewrite include finction to only heed nearest library --- tools/resources/__init__.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/resources/__init__.py b/tools/resources/__init__.py index 5b4e3ab5e0..0ab8eb66fe 100644 --- a/tools/resources/__init__.py +++ b/tools/resources/__init__.py @@ -268,15 +268,19 @@ class Resources(object): def _include_file(self, ref): _, path = ref - starts_with_included = any( - path.startswith(dirname(e.path)) - for e in self._libs_filtered - ) - starts_with_excluded = any( - path.startswith(dirname(e.path)) - for e in self._excluded_libs - ) - return starts_with_included or not starts_with_excluded + starts_with_excluded = [ + len(dirname(e.path)) for e in self._excluded_libs + if path.startswith(dirname(e.path)) + ] + if not starts_with_excluded: + return True + starts_with_included = [ + len(dirname(e.path)) for e in self._libs_filtered + if path.startswith(dirname(e.path)) + ] + if not starts_with_included: + return False + return max(starts_with_included) > max(starts_with_excluded) def get_file_refs(self, file_type): """Return a list of FileRef for every file of the given type"""