diff options
-rw-r--r-- | interpreter.py | 21 | ||||
-rw-r--r-- | test cases/common/31 find program/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/38 run program/meson.build | 4 |
3 files changed, 20 insertions, 7 deletions
diff --git a/interpreter.py b/interpreter.py index 5a7027c..13b916a 100644 --- a/interpreter.py +++ b/interpreter.py @@ -284,23 +284,35 @@ class GeneratedList(InterpreterObject): def get_generator(self): return self.generator +class Build(InterpreterObject): + def __init__(self): + InterpreterObject.__init__(self) + self.methods.update({'name' : self.get_name_method, + }) + + def get_name_method(self, args, kwargs): + return platform.system().lower() + # This currently returns data for the current environment. # It should return info for the target host. class Host(InterpreterObject): - - def __init__(self): + def __init__(self, envir): InterpreterObject.__init__(self) + self.environment = envir self.methods.update({'pointer_size' : self.get_ptrsize_method, 'name' : self.get_name_method, 'is_big_endian' : self.is_big_endian_method, }) - + # Is this needed any more since we have proper compiler + # based tests? Consider removing it. def get_ptrsize_method(self, args, kwargs): if sys.maxsize > 2**32: return 64 return 32 def get_name_method(self, args, kwargs): + if self.environment.is_cross_build(): + return self.environment.cross_info.get('name') return platform.system().lower() def is_big_endian_method(self, args, kwargs): @@ -810,7 +822,8 @@ class Interpreter(): self.sanity_check_ast() self.variables = {} self.builtin = {} - self.builtin['host'] = Host() + self.builtin['build'] = Build() + self.builtin['host'] = Host(build.environment) self.builtin['meson'] = MesonMain(build) self.environment = build.environment self.build_func_dict() diff --git a/test cases/common/31 find program/meson.build b/test cases/common/31 find program/meson.build index ec9c33b..7a407a9 100644 --- a/test cases/common/31 find program/meson.build +++ b/test cases/common/31 find program/meson.build @@ -1,6 +1,6 @@ project('find program', 'c') -if host.name() == 'windows' +if build.name() == 'windows' # Things Windows does not provide: # - an executable to copy files without prompting # - working command line quoting diff --git a/test cases/common/38 run program/meson.build b/test cases/common/38 run program/meson.build index 5fe03d3..4f02a35 100644 --- a/test cases/common/38 run program/meson.build +++ b/test cases/common/38 run program/meson.build @@ -1,6 +1,6 @@ project('run command', 'c') -if host.name() == 'windows' +if build.name() == 'windows' c = run_command('cmd', '/c', 'echo', 'hello') else c = run_command('echo', 'hello') @@ -24,7 +24,7 @@ endif # Now the same with a script. -if host.name() == 'windows' +if build.name() == 'windows' cs = run_command('scripts/hello.bat') else cs = run_command('scripts/hello.sh') |