File tree 1 file changed +15
-8
lines changed 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -470,14 +470,11 @@ def is_egg(self, search):
470
470
and base .endswith ('.egg' ))
471
471
472
472
def search (self , name ):
473
- for child in self .children ():
474
- n_low = child .lower ()
475
- if (n_low in name .exact_matches
476
- or n_low .replace ('.' , '_' ).startswith (name .prefix )
477
- and n_low .endswith (name .suffixes )
478
- # legacy case:
479
- or self .is_egg (name ) and n_low == 'egg-info' ):
480
- yield self .joinpath (child )
473
+ return (
474
+ self .joinpath (child )
475
+ for child in self .children ()
476
+ if name .matches (child , self )
477
+ )
481
478
482
479
483
480
class Prepared :
@@ -507,6 +504,16 @@ def normalize(name):
507
504
"""
508
505
return re .sub (r"[-_.]+" , "-" , name ).lower ().replace ('-' , '_' )
509
506
507
+ def matches (self , name , path ):
508
+ n_low = name .lower ()
509
+ return (
510
+ n_low in self .exact_matches
511
+ or n_low .replace ('.' , '_' ).startswith (self .prefix )
512
+ and n_low .endswith (self .suffixes )
513
+ # legacy case:
514
+ or path .is_egg (self ) and n_low == 'egg-info'
515
+ )
516
+
510
517
511
518
@install
512
519
class MetadataPathFinder (NullFinder , DistributionFinder ):
You can’t perform that action at this time.
0 commit comments