11import  argparse 
2+ import  fnmatch 
23import  glob 
34import  inspect 
45from  itertools  import  chain 
@@ -132,14 +133,22 @@ def add_subparser(cls, parent_parser, subparsers):
132133            help = "Generate a list of headers in TOML form" ,
133134            parents = [parent_parser ],
134135        )
135-         parser .add_argument ("--only-missing " , default = False , action = "store_true" )
136+         parser .add_argument ("--all " , default = False , action = "store_true" )
136137        return  parser 
137138
138139    def  run (self , args ):
139140        s  =  get_setup ()
140141
142+         to_ignore  =  s .project .scan_headers_ignore 
143+ 
144+         def  _should_ignore (f ):
145+             for  pat  in  to_ignore :
146+                 if  fnmatch .fnmatch (f , pat ):
147+                     return  True 
148+             return  False 
149+ 
141150        already_present  =  {}
142-         if  args .only_missing :
151+         if  not   args .all :
143152            for  i , wrapper  in  enumerate (s .project .wrappers .values ()):
144153                files  =  set ()
145154                if  wrapper .autogen_headers :
@@ -156,9 +165,7 @@ def run(self, args):
156165                            ifiles .add (f )
157166
158167        for  wrapper  in  s .wrappers :
159-             print (
160-                 f'[tool.robotpy-build.wrappers."{ wrapper .package_name }  ".autogen_headers]' 
161-             )
168+             printed  =  False 
162169
163170            # This uses the direct include directories instead of the generation 
164171            # search path as we only want to output a file once 
@@ -172,15 +179,22 @@ def run(self, args):
172179                            glob .glob (join (incdir , "**" , "*.h" ), recursive = True ),
173180                            glob .glob (join (incdir , "**" , "*.hpp" ), recursive = True ),
174181                        )
175-                         if  "rpygen"  not  in   f 
182+                         if  "rpygen"  not  in   f   and   not   _should_ignore ( relpath ( f ,  incdir )) 
176183                    )
177184                )
178185
186+                 files  =  [f  for  f  in  files  if  f  not  in   wpresent ]
187+                 if  not  files :
188+                     continue 
189+ 
190+                 if  not  printed :
191+                     print (
192+                         f'[tool.robotpy-build.wrappers."{ wrapper .package_name }  ".autogen_headers]' 
193+                     )
194+                     printed  =  True 
195+ 
179196                lastdir  =  None 
180197                for  f  in  files :
181-                     if  f  in  wpresent :
182-                         continue 
183- 
184198                    thisdir  =  f .parent 
185199                    if  lastdir  is  None :
186200                        if  thisdir :
0 commit comments