From 2bcc204a11073628e95f01181a0b037d81b64178 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 1 Mar 2022 18:54:05 -0500 Subject: document and raise an error for disallowed combination of install_headers args It makes no sense to specify both: - install_dir, which overrides the -Dincludedir= builtin option - subdir, which suffixes the -Dincludedir= builtin option We've always silently ignored the subdir in this case, which is really surprising if someone actually passed it and expected it to do something. We also confusingly didn't say anything in the documentation about it. Document that the options are incompatible, and explicitly check to see if they are both passed -- if so, raise an error message pointing out that only install_dir should be used. Fixes #10046 --- mesonbuild/interpreter/interpreter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mesonbuild/interpreter/interpreter.py') diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 97ec7c8..b2d7224 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2004,8 +2004,11 @@ external dependencies (including libraries) must go to "dependencies".''') kwargs: 'kwargs.FuncInstallHeaders') -> build.Headers: source_files = self.source_strings_to_files(args[0]) install_subdir = kwargs['subdir'] - if install_subdir is not None and os.path.isabs(install_subdir): - mlog.deprecation('Subdir keyword must not be an absolute path. This will be a hard error in the next release.') + if install_subdir is not None: + if kwargs['install_dir'] is not None: + raise InterpreterException('install_headers: cannot specify both "install_dir" and "subdir". Use only "install_dir".') + if os.path.isabs(install_subdir): + mlog.deprecation('Subdir keyword must not be an absolute path. This will be a hard error in the next release.') h = build.Headers(source_files, install_subdir, kwargs['install_dir'], kwargs['install_mode'], self.subproject) -- cgit v1.1