diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-01 23:51:43 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-22 14:15:22 -0400 |
commit | 3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6 (patch) | |
tree | 1657528ecf739758e226827e9e8f3eae1d3419c5 /mesonbuild/interpreter/interpreter.py | |
parent | e19e9ce6f196f7c127a2668b5df0ada1d50806df (diff) | |
download | meson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.zip meson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.tar.gz meson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.tar.bz2 |
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
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 17 |
1 files changed, 8 insertions, 9 deletions
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) |