repoman: simplify EbuildAssignment check
authorZac Medico <zmedico@gentoo.org>
Mon, 8 Oct 2012 14:17:20 +0000 (07:17 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 8 Oct 2012 14:17:20 +0000 (07:17 -0700)
The line continuation code is no longer needed since commit
a1578c654f26cab07309bc9cbddd3c95c0c205b5, because wrapped lines are
automatically joined before they are passed to the check. Also, inherit
ignore_comment = True from LineCheck.

pym/repoman/checks.py

index 9c076ead4eee334aaa1e4b6e00d6232487cf81cc..7e3d4b87511c18785e9b8d544fc6ea347cb1f50f 100644 (file)
@@ -221,21 +221,13 @@ class EbuildAssignment(LineCheck):
        """Ensure ebuilds don't assign to readonly variables."""
 
        repoman_check_name = 'variable.readonly'
-
        readonly_assignment = re.compile(r'^\s*(export\s+)?(A|CATEGORY|P|PV|PN|PR|PVR|PF|D|WORKDIR|FILESDIR|FEATURES|USE)=')
-       line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
-       ignore_line = re.compile(r'(^$)|(^(\t)*#)')
-       ignore_comment = False
-
-       def __init__(self):
-               self.previous_line = None
 
        def check(self, num, line):
                match = self.readonly_assignment.match(line)
                e = None
-               if match and (not self.previous_line or not self.line_continuation.match(self.previous_line)):
+               if match is not None:
                        e = errors.READONLY_ASSIGNMENT_ERROR
-               self.previous_line = line
                return e
 
 class Eapi3EbuildAssignment(EbuildAssignment):