mintro: Add exclude_{files, dirs} to install_subdir install_plan
These are necessary for projects outside Meson itself that want to extend the 'meson install' functionality as meson-python does to assemble Python package wheels from Meson projects. Fixes #11426.
This commit is contained in:
parent
b80f8456ec
commit
f39ccde513
|
@ -146,11 +146,19 @@ def list_install_plan(installdata: backends.InstallData) -> T.Dict[str, T.Dict[s
|
|||
if key == 'headers': # in the headers, install_path_name is the directory
|
||||
install_path_name = os.path.join(install_path_name, os.path.basename(data.path))
|
||||
|
||||
plan[data_type] = plan.get(data_type, {})
|
||||
plan[data_type][data.path] = {
|
||||
entry = {
|
||||
'destination': install_path_name,
|
||||
'tag': data.tag or None,
|
||||
}
|
||||
|
||||
if key == 'install_subdirs':
|
||||
exclude_files, exclude_dirs = data.exclude or ([], [])
|
||||
entry['exclude_dirs'] = list(exclude_dirs)
|
||||
entry['exclude_files'] = list(exclude_files)
|
||||
|
||||
plan[data_type] = plan.get(data_type, {})
|
||||
plan[data_type][data.path] = entry
|
||||
|
||||
return plan
|
||||
|
||||
def get_target_dir(coredata: cdata.CoreData, subdir: str) -> str:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Excluded
|
|
@ -0,0 +1 @@
|
|||
Placeholder
|
|
@ -0,0 +1 @@
|
|||
Installed
|
|
@ -94,6 +94,12 @@ install_subdir('custom_files',
|
|||
install_dir: get_option('datadir'),
|
||||
install_tag: 'custom',
|
||||
)
|
||||
install_subdir('excludes',
|
||||
install_dir: get_option('datadir'),
|
||||
install_tag: 'custom',
|
||||
exclude_directories: 'excluded',
|
||||
exclude_files: 'excluded.txt',
|
||||
)
|
||||
|
||||
# First is custom, 2nd is devel, 3rd has no tag
|
||||
custom_target('ct3',
|
||||
|
|
|
@ -4235,6 +4235,8 @@ class AllPlatformTests(BasePlatformTests):
|
|||
Path(installpath, 'usr/share/out3-custom.txt'),
|
||||
Path(installpath, 'usr/share/custom_files'),
|
||||
Path(installpath, 'usr/share/custom_files/data.txt'),
|
||||
Path(installpath, 'usr/share/excludes'),
|
||||
Path(installpath, 'usr/share/excludes/installed.txt'),
|
||||
Path(installpath, 'usr/lib'),
|
||||
Path(installpath, 'usr/lib/libbothcustom.a'),
|
||||
Path(installpath, 'usr/' + shared_lib_name('bothcustom')),
|
||||
|
@ -4442,7 +4444,15 @@ class AllPlatformTests(BasePlatformTests):
|
|||
'install_subdirs': {
|
||||
f'{testdir}/custom_files': {
|
||||
'destination': '{datadir}/custom_files',
|
||||
'tag': 'custom'
|
||||
'tag': 'custom',
|
||||
'exclude_dirs': [],
|
||||
'exclude_files': [],
|
||||
},
|
||||
f'{testdir}/excludes': {
|
||||
'destination': '{datadir}/excludes',
|
||||
'tag': 'custom',
|
||||
'exclude_dirs': ['excluded'],
|
||||
'exclude_files': ['excluded.txt'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue