@@ -261,26 +261,26 @@ def get_file_refs(self, file_type):
261
261
return list (self ._file_refs [file_type ])
262
262
263
263
def _all_parents (self , files ):
264
- for name in files :
264
+ for name , path in files :
265
265
components = name .split (self ._sep )
266
- start_at = 2 if components [ 0 ] in set ([ '' , '.' ]) else 1
267
- for index , directory in reversed (list (enumerate (components ))[ start_at :] ):
266
+ start_at = 0
267
+ for index , directory in reversed (list (enumerate (components ))):
268
268
if directory in self ._prefixed_labels :
269
269
start_at = index + 1
270
270
break
271
+ prefix = path .replace (name , "" )
271
272
for n in range (start_at , len (components )):
272
- parent = self ._sep .join (components [:n ])
273
- yield parent
273
+ parent_name = self ._sep .join (components [:n ])
274
+ parent_path = join (prefix , * components [:n ])
275
+ yield FileRef (parent_name , parent_path )
274
276
275
277
def _get_from_refs (self , file_type , key ):
276
278
if file_type is FileType .INC_DIR :
277
- parents = set (self ._all_parents (self ._get_from_refs (
278
- FileType .HEADER , key )))
279
- parents .add ("." )
279
+ parents = set (self ._all_parents (self ._file_refs [FileType .HEADER ]))
280
280
else :
281
281
parents = set ()
282
282
return sorted (
283
- list ( parents ) + [key (f ) for f in self .get_file_refs (file_type )]
283
+ [key (f ) for f in list ( parents ) + self .get_file_refs (file_type )]
284
284
)
285
285
286
286
0 commit comments