Fix bug and clarify error message in cross file validation

I believe the intent (from 30d0c2292f) 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.
pull/4003/head
John Ericson 6 years ago committed by Jussi Pakkanen
parent 15fb284395
commit 9f5c84279e
  1. 8
      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))

Loading…
Cancel
Save