@@ -1632,23 +1632,26 @@ def input_dir(self, dirname):
16321632 print ('directory ' + root )
16331633 counters ['directories' ] += 1
16341634 for subdir in sorted (dirs ):
1635- if self .excluded (os . path . join ( root , subdir ) ):
1635+ if self .excluded (subdir , root ):
16361636 dirs .remove (subdir )
16371637 for filename in sorted (files ):
16381638 # contain a pattern that matches?
16391639 if ((filename_match (filename , filepatterns ) and
1640- not self .excluded (os . path . join ( root , filename ) ))):
1640+ not self .excluded (filename , root ))):
16411641 runner (os .path .join (root , filename ))
16421642
1643- def excluded (self , filename ):
1643+ def excluded (self , filename , parent = None ):
16441644 """
16451645 Check if options.exclude contains a pattern that matches filename.
16461646 """
1647+ if not self .options .exclude :
1648+ return False
16471649 basename = os .path .basename (filename )
1648- return any ((filename_match (filename , self .options .exclude ,
1649- default = False ),
1650- filename_match (basename , self .options .exclude ,
1651- default = False )))
1650+ if filename_match (basename , self .options .exclude ):
1651+ return True
1652+ if parent :
1653+ filename = os .path .join (parent , filename )
1654+ return filename_match (filename , self .options .exclude )
16521655
16531656 def ignore_code (self , code ):
16541657 """
0 commit comments