configure_file: Allow setting install_dir: false with deprecation

Also add location node for two more deprecations

See: https://github.com/mesonbuild/meson/pull/4489#issuecomment-459246879
pull/4862/head
Nirbheek Chauhan 6 years ago committed by Xavier Claessens
parent 042f5638bf
commit 1575bd988a
  1. 9
      mesonbuild/interpreter.py
  2. 6
      test cases/common/14 configure file/meson.build

@ -276,7 +276,8 @@ class ConfigurationDataHolder(MutableInterpreterObject, ObjectHolder):
if len(args) == 1 and isinstance(args[0], list) and len(args[0]) == 2:
mlog.deprecation('Passing a list as the single argument to '
'configuration_data.set is deprecated. This will '
'become a hard error in the future.')
'become a hard error in the future.',
location=self.current_node)
args = args[0]
if len(args) != 2:
@ -289,7 +290,7 @@ class ConfigurationDataHolder(MutableInterpreterObject, ObjectHolder):
msg = 'Setting a configuration data value to {!r} is invalid, ' \
'and will fail at configure_file(). If you are using it ' \
'just to store some values, please use a dict instead.'
mlog.deprecation(msg.format(val))
mlog.deprecation(msg.format(val), location=self.current_node)
desc = kwargs.get('description', None)
if not isinstance(name, str):
raise InterpreterException("First argument to set must be a string.")
@ -3594,6 +3595,10 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
# for backwards compatibility. That was the behaviour before
# 0.45.0 so preserve it.
idir = kwargs.get('install_dir', '')
if idir is False:
idir = ''
mlog.deprecation('Please use the new `install:` kwarg instead of passing '
'`false` to `install_dir:`', location=node)
if not isinstance(idir, str):
raise InterpreterException('"install_dir" must be a string')
install = kwargs.get('install', idir != '')

@ -141,6 +141,12 @@ cfile = configure_file(input : 'config.h.in',
install_dir : '',
configuration : conf)
# test install_dir : false (deprecated)
cfile = configure_file(input : 'config.h.in',
output : 'do_not_get_installed_please.h',
install_dir : false,
configuration : conf)
# test intsall_dir with install: false
cfile = configure_file(input : 'config.h.in',
output : 'do_not_get_installed_in_install_dir.h',

Loading…
Cancel
Save