aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-10-03 14:35:30 -0400
committerEli Schwartz <eschwartz@archlinux.org>2021-10-08 14:35:00 -0400
commit108bd996ee72b16c14f0ee0ca86959b142582394 (patch)
tree2cc138363c7139ce3fa2ae918e75ac5b81d19c77 /mesonbuild/backend/backends.py
parent54e17ad5975252242712dc3b613bdbd0a2504e23 (diff)
downloadmeson-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/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 6218156..3d8654e 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -120,6 +120,7 @@ class InstallData:
self.targets: T.List[TargetInstallData] = []
self.headers: T.List[InstallDataBase] = []
self.man: T.List[InstallDataBase] = []
+ self.emptydir: T.List[InstallEmptyDir] = []
self.data: T.List[InstallDataBase] = []
self.install_scripts: T.List[ExecutableSerialisation] = []
self.install_subdirs: T.List[SubdirInstallData] = []
@@ -147,6 +148,13 @@ class TargetInstallData:
self.optional = optional
self.tag = tag
+class InstallEmptyDir:
+ def __init__(self, path: str, install_mode: 'FileMode', subproject: str, tag: T.Optional[str] = None):
+ self.path = path
+ self.install_mode = install_mode
+ self.subproject = subproject
+ self.tag = tag
+
class InstallDataBase:
def __init__(self, path: str, install_path: str, install_path_name: str,
install_mode: 'FileMode', subproject: str, tag: T.Optional[str] = None,
@@ -1470,6 +1478,7 @@ class Backend:
self.generate_target_install(d)
self.generate_header_install(d)
self.generate_man_install(d)
+ self.generate_emptydir_install(d)
self.generate_data_install(d)
self.generate_custom_install_script(d)
self.generate_subdir_install(d)
@@ -1665,6 +1674,12 @@ class Backend:
i = InstallDataBase(srcabs, dstabs, dstname, m.get_custom_install_mode(), m.subproject, tag='man')
d.man.append(i)
+ def generate_emptydir_install(self, d: InstallData) -> None:
+ emptydir: T.List[build.EmptyDir] = self.build.get_emptydir()
+ for e in emptydir:
+ i = InstallEmptyDir(e.path, e.install_mode, e.subproject, e.install_tag)
+ d.emptydir.append(i)
+
def generate_data_install(self, d: InstallData) -> None:
data = self.build.get_data()
srcdir = self.environment.get_source_dir()