]> git.ipfire.org Git - pakfire.git/commitdiff
Support := operator for variables.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Oct 2011 09:40:23 +0000 (11:40 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Oct 2011 09:40:23 +0000 (11:40 +0200)
Works exactly like := in GNU make.

python/pakfire/packages/lexer.py

index 80d97673587c8b4e563f7112a9cc40fb8548e8b9..99a71ae7d21c250f46ab420b5697b39f7381a872 100644 (file)
@@ -32,7 +32,7 @@ LEXER_COMMENT         = re.compile(r"^\s*#")
 LEXER_QUOTES          = "\"'"
 LEXER_EMPTY_LINE      = re.compile(r"^\s*$")
 
-LEXER_DEFINITION      = re.compile(r"^([A-Za-z0-9_\-]+)\s*(\+)?=\s*(.+)?$")
+LEXER_DEFINITION      = re.compile(r"^([A-Za-z0-9_\-]+)\s*([\+\:])?=\s*(.+)?$")
 
 LEXER_BLOCK_LINE_INDENT = "\t"
 LEXER_BLOCK_LINE      = re.compile(r"^\t(.*)$")
@@ -334,6 +334,10 @@ class Lexer(object):
                        if prev:
                                v = " ".join((prev or "", v))
 
+               elif o == ":":
+                       # Expand the value immediately and save it.
+                       v = self.expand_string(v)
+
                # Handle backslash.
                while v and v.endswith("\\"):
                        line = self.get_line(self._lineno)