From 3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 1 Aug 2022 23:51:43 -0400 Subject: introspection: untangle install_plan implemetation, fix a bunch of wrong ones Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601 --- mesonbuild/interpreter/interpreter.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'mesonbuild/interpreter/interpreter.py') diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 8caf010..131f073 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2342,14 +2342,8 @@ class Interpreter(InterpreterBase, HoldableObject): '"rename" and "sources" argument lists must be the same length if "rename" is given. ' f'Rename has {len(rename)} elements and sources has {len(sources)}.') - install_dir_name = kwargs['install_dir'] - if install_dir_name: - if not os.path.isabs(install_dir_name): - install_dir_name = os.path.join('{datadir}', install_dir_name) - else: - install_dir_name = '{datadir}' return self.install_data_impl(sources, kwargs['install_dir'], kwargs['install_mode'], - rename, kwargs['install_tag'], install_dir_name, + rename, kwargs['install_tag'], preserve_path=kwargs['preserve_path']) def install_data_impl(self, sources: T.List[mesonlib.File], install_dir: T.Optional[str], @@ -2361,7 +2355,9 @@ class Interpreter(InterpreterBase, HoldableObject): """Just the implementation with no validation.""" idir = install_dir or '' - idir_name = install_dir_name or idir + idir_name = install_dir_name or idir or '{datadir}' + if isinstance(idir_name, P_OBJ.OptionString): + idir_name = idir_name.optname dirs = collections.defaultdict(list) ret_data = [] if preserve_path: @@ -2594,10 +2590,13 @@ class Interpreter(InterpreterBase, HoldableObject): if not idir: raise InterpreterException( '"install_dir" must be specified when "install" in a configure_file is true') + idir_name = idir + if isinstance(idir_name, P_OBJ.OptionString): + idir_name = idir_name.optname cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname) install_mode = kwargs['install_mode'] install_tag = kwargs['install_tag'] - self.build.data.append(build.Data([cfile], idir, idir, install_mode, self.subproject, + self.build.data.append(build.Data([cfile], idir, idir_name, install_mode, self.subproject, install_tag=install_tag, data_type='configure')) return mesonlib.File.from_built_file(self.subdir, output) -- cgit v1.1