@@ -64,6 +64,14 @@ def find_included_file(self, file_path, source_dir):
6464
6565 return None
6666
67+ def add_excluded_files (self ):
68+ search_files = self .exclude_files [:]
69+ for search_file in search_files :
70+ found_excluded_path = self .find_included_file (search_file , None )
71+ if found_excluded_path :
72+ norm_excluded_path = os .path .normpath (found_excluded_path )
73+ self .excluded_files .append (os .path .normpath (norm_excluded_path ))
74+
6775 def __init__ (self , args ):
6876 with open (args .config , 'r' ) as f :
6977 config = json .loads (f .read ())
@@ -74,6 +82,8 @@ def __init__(self, args):
7482 self .prologue = args .prologue
7583 self .source_path = args .source_path
7684 self .included_files = []
85+ self .excluded_files = []
86+ self .add_excluded_files ()
7787
7888 # Generate the amalgamation and write it to the target file.
7989 def generate (self ):
@@ -89,6 +99,7 @@ def generate(self):
8999 print (" working_dir = {0}" .format (os .getcwd ()))
90100 print (" include_paths = {0}" .format (self .include_paths ))
91101 print (" force_include = {0}" .format (self .force_include ))
102+ print (" exclude_files = {0}" .format (self .exclude_files ))
92103 print ("Creating amalgamation:" )
93104 for file_path in self .sources :
94105 # Do not check the include paths while processing the source
@@ -239,9 +250,10 @@ def _process_includes(self):
239250 found_included_path = self .amalgamation .find_included_file (
240251 include_path , self .file_dir if search_same_dir else None )
241252 if found_included_path :
242- includes .append ((include_match , found_included_path ))
243- #if self.amalgamation.verbose:
244- # print(" #include = {0}".format(include_path))
253+ if not os .path .normpath (found_included_path ) in self .amalgamation .excluded_files :
254+ includes .append ((include_match , found_included_path ))
255+ #if self.amalgamation.verbose:
256+ # print(" #include = {0}".format(include_path))
245257 include_match = self .include_pattern .search (self .content ,
246258 include_match .end ())
247259
0 commit comments