/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/file_matcher.py

  • Committer: Tim Marston
  • Date: 2016-04-10 20:20:56 UTC
  • Revision ID: tim@ed.am-20160410202056-x0mo1ktjbjgqe2pr
added symlink to executable

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                        # if section is set, capture lines after the section heading and
56
56
                        # only until the next heading
57
57
                        if capture:
58
 
                                if self.section and re.match( '\[.*\]', line ): break
 
58
                                if self.section and re.match( '\[', line ): break
59
59
                                self.patterns.append( self.convert_line_to_regex( line ) )
60
60
                        elif self.section and line == '[' + self.section + ']':
61
61
                                capture = True
70
70
#                       line = line[ 1:-1 ]
71
71
 
72
72
                # detect escaped chars
73
 
#               if quotes == 
 
73
#               if quotes ==
74
74
 
75
75
                # convert * and ?
76
76
                line = re.sub( r'\?', '.', line )
77
77
                line = re.sub( r'\*', '.*', line )
 
78
                line = "^%s$" % ( line )
78
79
 
79
80
                return line
80
81
 
81
82
 
82
83
        def matches( self, rel_file ):
83
84
                for pattern in self.patterns:
84
 
                        if re.match( pattern, rel_file ):
 
85
                        if re.search( pattern, rel_file ):
85
86
                                return True
86
87
                return False
87
88