The error message is misleading (talks about external dependencies), and
doesn't tell you what you need to do (use the output of
declare_dependency, dependency, or find_library). At the same time
rename add_external_deps to add_deps since it adds internal deps too.
Plus many more error message improvements all over the place.
raiseInvalidCode('Global arguments can not be set in subprojects because there is no way to make that reliable.')
msg='Global arguments can not be set in subprojects because ' \
'there is no way to make that reliable.\nPlease only call ' \
'this if is_subproject() returns false. Alternatively, ' \
'define a variable that\ncontains your language-specific ' \
'arguments and add it to the appropriate *_args kwarg ' \
'in each target.'
raiseInvalidCode(msg)
ifself.global_args_frozen:
raiseInvalidCode('Tried to set global arguments after a build target has been declared.\nThis is not permitted. Please declare all global arguments before your targets.')
msg='Tried to set global arguments after a build target has ' \
'been declared.\nThis is not permitted. Please declare all ' \
'global arguments before your targets.'
raiseInvalidCode(msg)
ifnot'language'inkwargs:
raiseInvalidCode('Missing language definition in add_global_arguments')
lang=kwargs['language'].lower()
@ -2280,11 +2289,20 @@ requirements use the version keyword argument instead.''')
raiseInvalidCode('Global arguments can not be set in subprojects because there is no way to make that reliable.')
msg='Global link arguments can not be set in subprojects because ' \
'there is no way to make that reliable.\nPlease only call ' \
'this if is_subproject() returns false. Alternatively, ' \
'define a variable that\ncontains your language-specific ' \
'arguments and add it to the appropriate *_args kwarg ' \
'in each target.'
raiseInvalidCode(msg)
ifself.global_args_frozen:
raiseInvalidCode('Tried to set global arguments after a build target has been declared.\nThis is not permitted. Please declare all global arguments before your targets.')
msg='Tried to set global link arguments after a build target has ' \
'been declared.\nThis is not permitted. Please declare all ' \
'global arguments before your targets.'
raiseInvalidCode(msg)
ifnot'language'inkwargs:
raiseInvalidCode('Missing language definition in add_global_arguments')
raiseInvalidCode('Missing language definition in add_global_link_arguments')
lang=kwargs['language'].lower()
iflanginself.build.global_link_args:
self.build.global_link_args[lang]+=args
@ -2405,7 +2423,7 @@ requirements use the version keyword argument instead.''')
@ -2413,7 +2431,7 @@ requirements use the version keyword argument instead.''')
continue# This means a generated source and they always exist.
fname=os.path.join(subdir,s)
ifnotos.path.isfile(fname):
raiseInterpreterException('Tried to add non-existing source %s.'%s)
raiseInterpreterException('Tried to add non-existing source file %s.'%s)
deffunction_call(self,node):
func_name=node.func_name
@ -2469,7 +2487,7 @@ requirements use the version keyword argument instead.''')
else:
returnposargs[1]
else:
raiseInterpreterException('bool.to_string() must have either no arguments or exactly two string arguments.')
raiseInterpreterException('bool.to_string() must have either no arguments or exactly two string arguments that signify what values to return for true and false.')
elifmethod_name=='to_int':
ifobj==True:
return1
@ -2509,7 +2527,7 @@ requirements use the version keyword argument instead.''')
returnre.sub(r'[^a-zA-Z0-9]','_',obj)
elifmethod_name=='split':
iflen(posargs)>1:
raiseInterpreterException('Split() must have at most one argument.')
raiseInterpreterException('Split() must have at most one argument.')
eliflen(posargs)==1:
s=posargs[0]
ifnotisinstance(s,str):
@ -2530,7 +2548,7 @@ requirements use the version keyword argument instead.''')
try:
returnint(obj)
exceptException:
raiseInterpreterException('String can not be converted to int: '+obj)
raiseInterpreterException('String {!r} cannot be converted to int'.format(obj))
elifmethod_name=='join':
iflen(posargs)!=1:
raiseInterpreterException('Join() takes exactly one argument.')
@ -2635,8 +2653,7 @@ requirements use the version keyword argument instead.''')
foriinnode.ifs:
result=self.evaluate_statement(i.condition)
ifnot(isinstance(result,bool)):
print(result)
raiseInvalidCode('If clause does not evaluate to true or false.')
raiseInvalidCode('If clause {!r} does not evaluate to true or false.'.format(result))