summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-08-10 11:36:52 +0200
committerAndrew Bartlett <abartlet@samba.org>2017-08-24 05:39:26 +0200
commit59dc9eb776551ee73cc11e1c1215b311d5299d4d (patch)
tree3aed9b5976e9764cf88ccf40db68c5b9cadf02e6 /buildtools/wafsamba
parenta475e1c4b0009987a818faa953d1be3ee9b68894 (diff)
downloadsamba-59dc9eb776551ee73cc11e1c1215b311d5299d4d.tar.gz
wafsamba: Add INSTALL_DIR function
The install_dir function in waf has been deprecated and it doesn't support setting directory permissions. So we need to implement our own function anyway. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12957 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/wafsamba.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 1bdabf60640..b1e617916e0 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -885,6 +885,24 @@ def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
python_fixup=python_fixup, base_name=trim_path)
Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
+def INSTALL_DIR(bld, path, chmod=0o755):
+ """Install a directory if it doesn't exist, always set permissions."""
+
+ if not path:
+ return []
+
+ if bld.is_install > 0:
+ path = bld.EXPAND_VARIABLES(path)
+ if not os.path.isdir(path):
+ try:
+ os.makedirs(path)
+ os.chmod(path, chmod)
+ except OSError, e:
+ if not os.path.isdir(path):
+ raise Utils.WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
+ else:
+ os.chmod(path, chmod)
+Build.BuildContext.INSTALL_DIR = INSTALL_DIR
def INSTALL_DIRS(bld, destdir, dirs):
'''install a set of directories'''