|
|
@ -180,6 +180,37 @@ class ConfigureFileHolder(InterpreterObject): |
|
|
|
InterpreterObject.__init__(self) |
|
|
|
InterpreterObject.__init__(self) |
|
|
|
self.held_object = build.ConfigureFile(subdir, sourcename, targetname, configuration_data) |
|
|
|
self.held_object = build.ConfigureFile(subdir, sourcename, targetname, configuration_data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EnvironmentVariablesHolder(InterpreterObject): |
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
|
|
|
super().__init__() |
|
|
|
|
|
|
|
self.held_object = build.EnvironmentVariables() |
|
|
|
|
|
|
|
self.methods.update({'set': self.set_method, |
|
|
|
|
|
|
|
'append': self.append_method, |
|
|
|
|
|
|
|
'prepend' : self.prepend_method, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@stringArgs |
|
|
|
|
|
|
|
def add_var(self, method, args, kwargs): |
|
|
|
|
|
|
|
if not isinstance(kwargs.get("separator", ""), str): |
|
|
|
|
|
|
|
raise InterpreterException("EnvironmentVariablesHolder methods 'separator'" |
|
|
|
|
|
|
|
" argument needs to be a string.") |
|
|
|
|
|
|
|
if len(args) < 2: |
|
|
|
|
|
|
|
raise InterpreterException("EnvironmentVariablesHolder methods require at least" |
|
|
|
|
|
|
|
"2 arguments, first is the name of the variable and" |
|
|
|
|
|
|
|
" following one are values") |
|
|
|
|
|
|
|
self.held_object.envvars.append((method, args[0], args[1:], kwargs)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_method(self, args, kwargs): |
|
|
|
|
|
|
|
self.add_var(self.held_object.set, args, kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def append_method(self, args, kwargs): |
|
|
|
|
|
|
|
self.add_var(self.held_object.append, args, kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prepend_method(self, args, kwargs): |
|
|
|
|
|
|
|
self.add_var(self.held_object.prepend, args, kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationDataHolder(InterpreterObject): |
|
|
|
class ConfigurationDataHolder(InterpreterObject): |
|
|
|
def __init__(self): |
|
|
|
def __init__(self): |
|
|
|
super().__init__() |
|
|
|
super().__init__() |
|
|
@ -1124,6 +1155,7 @@ class Interpreter(): |
|
|
|
'files' : self.func_files, |
|
|
|
'files' : self.func_files, |
|
|
|
'declare_dependency': self.func_declare_dependency, |
|
|
|
'declare_dependency': self.func_declare_dependency, |
|
|
|
'assert': self.func_assert, |
|
|
|
'assert': self.func_assert, |
|
|
|
|
|
|
|
'environment' : self.func_environment, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def module_method_callback(self, invalues): |
|
|
|
def module_method_callback(self, invalues): |
|
|
@ -1949,6 +1981,9 @@ class Interpreter(): |
|
|
|
if not isinstance(i, (str, mesonlib.File)): |
|
|
|
if not isinstance(i, (str, mesonlib.File)): |
|
|
|
raise InterpreterException('Command line arguments must be strings') |
|
|
|
raise InterpreterException('Command line arguments must be strings') |
|
|
|
envlist = kwargs.get('env', []) |
|
|
|
envlist = kwargs.get('env', []) |
|
|
|
|
|
|
|
if isinstance(envlist, EnvironmentVariablesHolder): |
|
|
|
|
|
|
|
env = envlist.held_object |
|
|
|
|
|
|
|
else: |
|
|
|
if not isinstance(envlist, list): |
|
|
|
if not isinstance(envlist, list): |
|
|
|
envlist = [envlist] |
|
|
|
envlist = [envlist] |
|
|
|
env = {} |
|
|
|
env = {} |
|
|
@ -2147,6 +2182,10 @@ class Interpreter(): |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.build.global_link_args[lang] = args |
|
|
|
self.build.global_link_args[lang] = args |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def func_environment(self, node, args, kwargs): |
|
|
|
|
|
|
|
return EnvironmentVariablesHolder() |
|
|
|
|
|
|
|
|
|
|
|
def flatten(self, args): |
|
|
|
def flatten(self, args): |
|
|
|
if isinstance(args, mparser.StringNode): |
|
|
|
if isinstance(args, mparser.StringNode): |
|
|
|
return args.value |
|
|
|
return args.value |
|
|
|