Properly escape { and } characters in regular expressions even
authorZac Medico <zmedico@gentoo.org>
Thu, 1 Nov 2007 18:26:41 +0000 (18:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 1 Nov 2007 18:26:41 +0000 (18:26 -0000)
though it seems to work either way.

svn path=/main/trunk/; revision=8355

pym/repoman/checks.py

index 66918cbd8fc05ef403220e4662982fcee224b2b7..b6c430569407d4df160b6f3b590e12f6ebe6680a 100644 (file)
@@ -120,10 +120,10 @@ class EbuildQuote(ContentCheck):
        repoman_check_name = 'ebuild.minorsyn'
        ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)|(^\s*(local|export)\s+)')
        var_names = r'(D|S|T|ROOT|FILESDIR|WORKDIR)'
-       var_reference = re.compile(r'\$({'+var_names+'}|' + \
+       var_reference = re.compile(r'\$(\{'+var_names+'\}|' + \
                var_names + '\W)')
-       missing_quotes = re.compile(r'(\s|^)[^"\s]*\${?' + var_names + \
-               r'}?[^"\s]*(\s|$)')
+       missing_quotes = re.compile(r'(\s|^)[^"\s]*\$\{?' + var_names + \
+               r'\}?[^"\s]*(\s|$)')
        cond_begin =  re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
        cond_end =  re.compile(r'(^|\s+)\]\]($|\\$|\s+)')