Bug 780407 - Pymake: Export variables in MAKEFLAGS, including those passed over the command-line. r=khuey

This commit is contained in:
Siddharth Agarwal 2012-08-05 03:22:00 +05:30
parent cb996847fc
commit 5c170e7fab
3 changed files with 14 additions and 10 deletions

View File

@ -498,9 +498,9 @@ def parsestring(s, filename):
e.rstrip()
if token is None:
condstack[-1].append(parserdata.ExportDirective(e, single=False))
condstack[-1].append(parserdata.ExportDirective(e, concurrent_set=False))
else:
condstack[-1].append(parserdata.ExportDirective(e, single=True))
condstack[-1].append(parserdata.ExportDirective(e, concurrent_set=True))
value = flattenmakesyntax(d, offset).lstrip()
condstack[-1].append(parserdata.SetVariable(e, value=value, valueloc=d.getloc(offset), token=token, targetexp=None))

View File

@ -88,6 +88,7 @@ def parsecommandlineargs(args):
vname = vname.strip()
vnameexp = data.Expansion.fromstring(vname, "Command-line argument")
stmts.append(ExportDirective(vnameexp, concurrent_set=True))
stmts.append(SetVariable(vnameexp, token=t,
value=val, valueloc=Location('<command-line>', i, len(vname) + len(t)),
targetexp=None, source=data.Variables.SOURCE_COMMANDLINE))
@ -548,20 +549,22 @@ class ExportDirective(Statement):
See https://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
The `single` field defines whether this statement occurred with or without
a variable assignment. If True, no variable assignment was present. If
False, the SetVariable immediately following this statement originally came
from this export directive (the parser splits it into multiple statements).
The `concurrent_set` field defines whether this statement occurred with or
without a variable assignment. If False, no variable assignment was
present. If True, the SetVariable immediately following this statement
originally came from this export directive (the parser splits it into
multiple statements).
"""
__slots__ = ('exp', 'single')
def __init__(self, exp, single):
__slots__ = ('exp', 'concurrent_set')
def __init__(self, exp, concurrent_set):
assert isinstance(exp, (data.Expansion, data.StringExpansion))
self.exp = exp
self.single = single
self.concurrent_set = concurrent_set
def execute(self, makefile, context):
if self.single:
if self.concurrent_set:
vlist = [self.exp.resolvestr(makefile, makefile.variables)]
else:
vlist = list(self.exp.resolvesplit(makefile, makefile.variables))

View File

@ -2,5 +2,6 @@
all:
test "$(OVAR)" = "oval"
test "$$OVAR" = "oval"
@echo TEST-PASS