/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-02-13 11:38:50 UTC
  • Revision ID: tim@ed.am-20160213113850-iaplsdx6h1y4l21b
switch to lzip

Show diffs side-by-side

added added

removed removed

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 )
79
78
 
80
79
                return line
81
80
 
82
81
 
83
82
        def matches( self, rel_file ):
84
83
                for pattern in self.patterns:
85
 
                        if re.search( pattern, rel_file ):
 
84
                        if re.match( pattern, rel_file ):
86
85
                                return True
87
86
                return False
88
87