Skip to content

Commit 20bbe1b

Browse files
lithomas1nirbheek
authored andcommitted
Fix install_subdirs not showing up in intro-install_plan.json
1 parent 66d94e7 commit 20bbe1b

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

mesonbuild/backend/backends.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1757,9 +1757,11 @@ def generate_subdir_install(self, d: InstallData) -> None:
17571757
dst_dir = os.path.join(self.environment.get_prefix(),
17581758
sd.install_dir)
17591759
dst_name = os.path.join('{prefix}', sd.install_dir)
1760+
if sd.install_dir != sd.install_dir_name:
1761+
dst_name = sd.install_dir_name
17601762
if not sd.strip_directory:
17611763
dst_dir = os.path.join(dst_dir, os.path.basename(src_dir))
1762-
dst_name = os.path.join(dst_dir, os.path.basename(src_dir))
1764+
dst_name = os.path.join(dst_name, os.path.basename(src_dir))
17631765
i = SubdirInstallData(src_dir, dst_dir, dst_name, sd.install_mode, sd.exclude, sd.subproject, sd.install_tag)
17641766
d.install_subdirs.append(i)
17651767

mesonbuild/build.py

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class InstallDir(HoldableObject):
202202
source_subdir: str
203203
installable_subdir: str
204204
install_dir: str
205+
install_dir_name: str
205206
install_mode: 'FileMode'
206207
exclude: T.Tuple[T.Set[str], T.Set[str]]
207208
strip_directory: bool

mesonbuild/interpreter/interpreter.py

+5
Original file line numberDiff line numberDiff line change
@@ -2382,10 +2382,15 @@ def func_install_subdir(self, node: mparser.BaseNode, args: T.Tuple[str],
23822382
FeatureDeprecated.single_use('install_subdir with empty directory', '0.60.0', self.subproject,
23832383
'It worked by accident and is buggy. Use install_emptydir instead.', node)
23842384

2385+
idir_name = kwargs['install_dir']
2386+
if isinstance(idir_name, P_OBJ.OptionString):
2387+
idir_name = idir_name.optname
2388+
23852389
idir = build.InstallDir(
23862390
self.subdir,
23872391
args[0],
23882392
kwargs['install_dir'],
2393+
idir_name,
23892394
kwargs['install_mode'],
23902395
exclude,
23912396
kwargs['strip_directory'],

mesonbuild/mintro.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ def list_install_plan(installdata: backends.InstallData) -> T.Dict[str, T.Dict[s
134134
'data': installdata.data,
135135
'man': installdata.man,
136136
'headers': installdata.headers,
137+
'install_subdirs': installdata.install_subdirs
137138
}.items():
138-
for data in data_list:
139+
# Mypy doesn't recognize SubdirInstallData as a subclass of InstallDataBase
140+
for data in data_list: # type: ignore[attr-defined]
139141
data_type = data.data_type or key
140142
install_path_name = data.install_path_name
141143
if key == 'headers': # in the headers, install_path_name is the directory

mesonbuild/modules/unstable_external_project.py

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def _create_targets(self, extra_depends: T.List[T.Union['BuildTarget', 'CustomTa
245245
idir = build.InstallDir(self.subdir.as_posix(),
246246
Path('dist', self.rel_prefix).as_posix(),
247247
install_dir='.',
248+
install_dir_name='.',
248249
install_mode=None,
249250
exclude=None,
250251
strip_directory=True,

unittests/allplatformstests.py

+6
Original file line numberDiff line numberDiff line change
@@ -4284,6 +4284,12 @@ def output_name(name, type_):
42844284
'destination': '{includedir}/foo3-devel.h',
42854285
'tag': 'devel',
42864286
},
4287+
},
4288+
'install_subdirs': {
4289+
f'{testdir}/custom_files': {
4290+
'destination': '{datadir}/custom_files',
4291+
'tag': 'custom'
4292+
}
42874293
}
42884294
}
42894295

0 commit comments

Comments
 (0)