diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-03 14:35:30 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-08 14:35:00 -0400 |
commit | 108bd996ee72b16c14f0ee0ca86959b142582394 (patch) | |
tree | 2cc138363c7139ce3fa2ae918e75ac5b81d19c77 /mesonbuild/interpreter/interpreter.py | |
parent | 54e17ad5975252242712dc3b613bdbd0a2504e23 (diff) | |
download | meson-108bd996ee72b16c14f0ee0ca86959b142582394.zip meson-108bd996ee72b16c14f0ee0ca86959b142582394.tar.gz meson-108bd996ee72b16c14f0ee0ca86959b142582394.tar.bz2 |
add install_emptydir function
This replaces the absolute hack of using
```
install_subdir('nonexisting', install_dir: 'share')
```
which requires you to make sure you don't accidentally or deliberately
have a completely different directory with the same name in your source
tree that is full of files you don't want installed. It also avoids
splitting the name in two and listing them in the wrong order.
You can also set the install mode of each directory component by listing
them one at a time in order, and in fact create nested structures at
all.
Fixes #1604
Properly fixes #2904
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 9a89b0c..8ac92c8 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -349,6 +349,7 @@ class Interpreter(InterpreterBase, HoldableObject): 'install_data': self.func_install_data, 'install_headers': self.func_install_headers, 'install_man': self.func_install_man, + 'install_emptydir': self.func_install_emptydir, 'install_subdir': self.func_install_subdir, 'is_disabler': self.func_is_disabler, 'is_variable': self.func_is_variable, @@ -410,6 +411,7 @@ class Interpreter(InterpreterBase, HoldableObject): build.AliasTarget: OBJ.AliasTargetHolder, build.Headers: OBJ.HeadersHolder, build.Man: OBJ.ManHolder, + build.EmptyDir: OBJ.EmptyDirHolder, build.Data: OBJ.DataHolder, build.InstallDir: OBJ.InstallDirHolder, build.IncludeDirs: OBJ.IncludeDirsHolder, @@ -1896,6 +1898,17 @@ This will become a hard error in the future.''' % kwargs['input'], location=self return m + @FeatureNew('install_emptydir', '0.60.0') + @typed_kwargs( + 'install_emptydir', + INSTALL_MODE_KW + ) + def func_install_emptydir(self, node: mparser.BaseNode, args: T.Tuple[str], kwargs) -> None: + d = build.EmptyDir(args[0], kwargs['install_mode'], self.subproject) + self.build.emptydir.append(d) + + return d + @FeatureNewKwargs('subdir', '0.44.0', ['if_found']) @permittedKwargs({'if_found'}) @typed_pos_args('subdir', str) |