aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-08-07 21:20:49 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2018-08-10 00:20:55 +0300
commit9f5c84279e65b70865d873999205012f2a2b859e (patch)
tree01270229943ccaf4f156fc2fcf9bc882848139bd
parent15fb2843955b53414cf292cf0a6b7faf7ffc883a (diff)
downloadmeson-9f5c84279e65b70865d873999205012f2a2b859e.zip
meson-9f5c84279e65b70865d873999205012f2a2b859e.tar.gz
meson-9f5c84279e65b70865d873999205012f2a2b859e.tar.bz2
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.
-rw-r--r--mesonbuild/environment.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 099e5b9..28c26e2 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))