From 9f5c84279e65b70865d873999205012f2a2b859e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 7 Aug 2018 21:20:49 -0400 Subject: [PATCH] Fix bug and clarify error message in cross file validation I believe the intent (from 30d0c2292fee831d74f080e62c1c74990ea76abb) is that `[binaries]` isn't needed just for "target-only cross" (build == host != target). This fixes the code to match that, hopefully clarifying the control flow in the process, and also improves the message to make that clear. --- mesonbuild/environment.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 099e5b975..28c26e2f2 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -983,12 +983,10 @@ class CrossBuildInfo: def __init__(self, filename): self.config = {'properties': {}} self.parse_datafile(filename) - if 'target_machine' in self.config: - return - if 'host_machine' not in self.config: + if 'host_machine' not in self.config and 'target_machine' not in self.config: raise mesonlib.MesonException('Cross info file must have either host or a target machine.') - if 'binaries' not in self.config: - raise mesonlib.MesonException('Cross file is missing "binaries".') + if 'host_machine' in self.config and 'binaries' not in self.config: + raise mesonlib.MesonException('Cross file with "host_machine" is missing "binaries".') def ok_type(self, i): return isinstance(i, (str, int, bool))