properly error out when project version is an array other than files()

Due to the support for specifying version as files('VERSION'), we need
to internally accept an array, since that is what files() returns.
Before that, we didn't accept arrays, and after that, we don't intend to
accept generic arrays, only arrays as a side effect of files(). So
tighten the typechecking to ensure that that is what we actually get.
pull/9874/head
Eli Schwartz 3 years ago committed by Daniel Mensinger
parent 4f40962a05
commit a0d28e850e
  1. 4
      mesonbuild/interpreter/interpreter.py

@ -103,8 +103,8 @@ def _project_version_validator(value: T.Union[T.List, str, mesonlib.File, None])
if isinstance(value, list):
if len(value) != 1:
return 'when passed as array must have a length of 1'
elif not isinstance(value[0], (str, mesonlib.File)):
return 'when passed as array must contain a string or File'
elif not isinstance(value[0], mesonlib.File):
return 'when passed as array must contain a File'
return None

Loading…
Cancel
Save