diff options
author | Thomas Li <47963215+lithomas1@users.noreply.github.com> | 2022-09-02 15:43:11 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-09-06 02:09:38 -0400 |
commit | a4d54422077a6fb7fe7af072e0563b58e602d4ae (patch) | |
tree | f99dee3e1aa8dd685518e848362d43da386745bb | |
parent | e6122ba7864cf7b4c20091651e69d33ba2f7b463 (diff) | |
download | meson-a4d54422077a6fb7fe7af072e0563b58e602d4ae.zip meson-a4d54422077a6fb7fe7af072e0563b58e602d4ae.tar.gz meson-a4d54422077a6fb7fe7af072e0563b58e602d4ae.tar.bz2 |
Fix install_subdirs not showing up in intro-install_plan.json
-rw-r--r-- | mesonbuild/backend/backends.py | 4 | ||||
-rw-r--r-- | mesonbuild/build.py | 1 | ||||
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 5 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 4 | ||||
-rw-r--r-- | mesonbuild/modules/external_project.py | 1 | ||||
-rw-r--r-- | unittests/allplatformstests.py | 6 |
6 files changed, 19 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 63b8731..304bea3 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1754,9 +1754,11 @@ class Backend: dst_dir = os.path.join(self.environment.get_prefix(), sd.install_dir) dst_name = os.path.join('{prefix}', sd.install_dir) + if sd.install_dir != sd.install_dir_name: + dst_name = sd.install_dir_name if not sd.strip_directory: dst_dir = os.path.join(dst_dir, os.path.basename(src_dir)) - dst_name = os.path.join(dst_dir, os.path.basename(src_dir)) + dst_name = os.path.join(dst_name, os.path.basename(src_dir)) i = SubdirInstallData(src_dir, dst_dir, dst_name, sd.install_mode, sd.exclude, sd.subproject, sd.install_tag) d.install_subdirs.append(i) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 877ef5a..7a3bf88 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -204,6 +204,7 @@ class InstallDir(HoldableObject): source_subdir: str installable_subdir: str install_dir: str + install_dir_name: str install_mode: 'FileMode' exclude: T.Tuple[T.Set[str], T.Set[str]] strip_directory: bool diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 71299af..3e6f343 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2419,10 +2419,15 @@ class Interpreter(InterpreterBase, HoldableObject): 'It worked by accident and is buggy. Use install_emptydir instead.', node) install_mode = self._warn_kwarg_install_mode_sticky(kwargs['install_mode']) + idir_name = kwargs['install_dir'] + if isinstance(idir_name, P_OBJ.OptionString): + idir_name = idir_name.optname + idir = build.InstallDir( self.subdir, args[0], kwargs['install_dir'], + idir_name, install_mode, exclude, kwargs['strip_directory'], diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index fd5c16f..5254b3a 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -137,8 +137,10 @@ def list_install_plan(installdata: backends.InstallData) -> T.Dict[str, T.Dict[s 'data': installdata.data, 'man': installdata.man, 'headers': installdata.headers, + 'install_subdirs': installdata.install_subdirs }.items(): - for data in data_list: + # Mypy doesn't recognize SubdirInstallData as a subclass of InstallDataBase + for data in data_list: # type: ignore[attr-defined] data_type = data.data_type or key install_path_name = data.install_path_name if key == 'headers': # in the headers, install_path_name is the directory diff --git a/mesonbuild/modules/external_project.py b/mesonbuild/modules/external_project.py index 1fd4911..dbbd84f 100644 --- a/mesonbuild/modules/external_project.py +++ b/mesonbuild/modules/external_project.py @@ -245,6 +245,7 @@ class ExternalProject(NewExtensionModule): idir = build.InstallDir(self.subdir.as_posix(), Path('dist', self.rel_prefix).as_posix(), install_dir='.', + install_dir_name='.', install_mode=None, exclude=None, strip_directory=True, diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 1b8ff85..8e0f934 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -4290,6 +4290,12 @@ class AllPlatformTests(BasePlatformTests): 'destination': '{includedir}/foo3-devel.h', 'tag': 'devel', }, + }, + 'install_subdirs': { + f'{testdir}/custom_files': { + 'destination': '{datadir}/custom_files', + 'tag': 'custom' + } } } |