Invert commandline variables so that they mean the right thing.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 05 Feb 2009 17:20:30 -0500
changeset 43 87a1810a9a52a342c6d62cdb483660b152632c65
parent 42 b8be4f91e866f33075786921dbad5748d73711d7
child 44 65ec57ff7d90d5e9a774a3bfc58d5cff48fab51d
push id24
push userbsmedberg@mozilla.com
push dateThu, 05 Feb 2009 22:24:54 +0000
Invert commandline variables so that they mean the right thing.
pymake/parser.py
--- a/pymake/parser.py
+++ b/pymake/parser.py
@@ -184,34 +184,39 @@ def skipwhitespace(d, offset):
 
 def parsetoend(d, offset, skipws):
     if skipws:
         offset = skipwhitespace(d, offset)
     value, offset = parsemakesyntax(d, offset, '')
     assert offset == -1
     return value
 
-def setvariable(variables, vname, recursive, value):
+def setvariable(variables, vname, recursive, value, fromcl=False):
     """
     Parse the remaining data at d[offset] into a variables object.
 
     @param vname an string holding the variable name
     """
     if len(vname) == 0:
         raise SyntaxError("Empty variable name", loc=d.getloc(offset))
 
+    if fromcl:
+        source = data.Variables.SOURCE_OVERRIDE
+    else:
+        source = data.Variables.SOURCE_MAKEFILE
+
     if recursive:
         flavor = data.Variables.FLAVOR_RECURSIVE
     else:
         flavor = data.Variables.FLAVOR_SIMPLE
         e = data.Expansion()
         e.append(value.resolve(variables, vname))
         value = e
         
-    variables.set(vname, flavor, data.Variables.SOURCE_MAKEFILE, value)
+    variables.set(vname, flavor, source, value)
 
 def parsecommandlineargs(makefile, args):
     """
     Given a set of arguments from a command-line invocation of make,
     parse out the variable definitions and return the rest as targets.
     """
 
     r = []
@@ -223,17 +228,17 @@ def parsecommandlineargs(makefile, args)
             else:
                 vname = a[:eqpos]
             vname = vname.strip()
             valtext = a[eqpos+1:].lstrip()
             d = Data()
             d.append(valtext, Location('<command-line>', 1, eqpos + 1))
             value, offset = parsemakesyntax(d, 0, '')
             assert offset == -1
-            setvariable(makefile.variables, vname, a[eqpos-1] == ':', value)
+            setvariable(makefile.variables, vname, a[eqpos-1] != ':', value, True)
         else:
             r.append(a)
 
     return r
 
 def parsestream(fd, filename, makefile):
     """
     Parse a stream of makefile into a makefile data structure.