Make checks a bit more robust against empty entries.

pull/3002/head
Jussi Pakkanen 7 years ago
parent 64ed9656f0
commit af2067b670
  1. 4
      mesonbuild/build.py
  2. 2
      mesonbuild/interpreter.py

@ -1637,6 +1637,10 @@ class CustomTarget(Target):
for i in self.outputs: for i in self.outputs:
if not(isinstance(i, str)): if not(isinstance(i, str)):
raise InvalidArguments('Output argument not a string.') raise InvalidArguments('Output argument not a string.')
if i == '':
raise InvalidArguments('Output must not be empty.')
if i.strip() == '':
raise InvalidArguments('Output must not consist only of whitespace.')
if '/' in i: if '/' in i:
raise InvalidArguments('Output must not contain a path segment.') raise InvalidArguments('Output must not contain a path segment.')
if '@INPUT@' in i or '@INPUT0@' in i: if '@INPUT@' in i or '@INPUT0@' in i:

@ -3006,6 +3006,8 @@ different subdirectory.
def add_target(self, name, tobj): def add_target(self, name, tobj):
if name == '': if name == '':
raise InterpreterException('Target name must not be empty.') raise InterpreterException('Target name must not be empty.')
if name.strip() == '':
raise InterpreterException('Target name must not consist only of whitespace.')
if name.startswith('meson-'): if name.startswith('meson-'):
raise InvalidArguments("Target names starting with 'meson-' are reserved " raise InvalidArguments("Target names starting with 'meson-' are reserved "
"for Meson's internal use. Please rename.") "for Meson's internal use. Please rename.")

Loading…
Cancel
Save