aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2018-11-07 21:33:34 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2019-01-13 19:51:31 +0200
commit95c1cdf7767d5b5bf4614651afeafa100f1de45c (patch)
treec91536f545e071d8cc11bf935f7c2002e6bb685e /mesonbuild/interpreter.py
parent49557e15ec62c7db21b3619d957e4f65772660d6 (diff)
downloadmeson-95c1cdf7767d5b5bf4614651afeafa100f1de45c.zip
meson-95c1cdf7767d5b5bf4614651afeafa100f1de45c.tar.gz
meson-95c1cdf7767d5b5bf4614651afeafa100f1de45c.tar.bz2
interpreter: obey to the install argument in configure_file
If a configure_file has an install_dir set, the supported install argument is ignored, while this should have actually higher priority than the install_dir itself. Also check that correct types are used for `install` and `install_dir`. Add test to verify this. Fixes #3983
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 2a9d96e..e3a6a0b 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3530,6 +3530,7 @@ This will become a hard error in the future.''' % kwargs['input'])
@FeatureNewKwargs('configure_file', '0.47.0', ['copy', 'output_format', 'install_mode', 'encoding'])
@FeatureNewKwargs('configure_file', '0.46.0', ['format'])
@FeatureNewKwargs('configure_file', '0.41.0', ['capture'])
+ @FeatureNewKwargs('configure_file', '0.50.0', ['install'])
@permittedKwargs(permitted_kwargs['configure_file'])
def func_configure_file(self, node, args, kwargs):
if len(args) > 0:
@@ -3689,8 +3690,17 @@ This will become a hard error in the future.''' % kwargs['input'])
# Install file if requested, we check for the empty string
# for backwards compatibility. That was the behaviour before
# 0.45.0 so preserve it.
- idir = kwargs.get('install_dir', None)
- if isinstance(idir, str) and idir:
+ idir = kwargs.get('install_dir', '')
+ if not isinstance(idir, str):
+ raise InterpreterException('"install_dir" must be a string')
+ install = kwargs.get('install', idir != '')
+ if not isinstance(install, bool):
+ raise InterpreterException('"install" must be a boolean')
+ if install:
+ if not idir:
+ raise InterpreterException('"install_dir" must be specified '
+ 'when "install" in a configure_file '
+ 'is true')
cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname)
install_mode = self._get_kwarg_install_mode(kwargs)
self.build.data.append(build.Data([cfile], idir, install_mode))