Commit 5c170e7f authored by Siddharth Agarwal's avatar Siddharth Agarwal
Browse files

Bug 780407 - Pymake: Export variables in MAKEFLAGS, including those passed...

Bug 780407 - Pymake: Export variables in MAKEFLAGS, including those passed over the command-line. r=khuey
parent cb996847
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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))
+11 −8
Original line number Diff line number Diff line
@@ -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))
+1 −0
Original line number Diff line number Diff line
@@ -2,5 +2,6 @@

all:
	test "$(OVAR)" = "oval"
	test "$$OVAR" = "oval"
	@echo TEST-PASS