buildtools/wafsamba: add install_dir to build context
authorAlexander Bokovoy <ab@samba.org>
Wed, 27 Jun 2018 13:06:44 +0000 (16:06 +0300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Sep 2018 04:37:25 +0000 (06:37 +0200)
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_waf18.py

index 0bb9b1b..0fb875d 100644 (file)
@@ -106,6 +106,23 @@ def undefine(self, key, from_env=True, comment=None):
     if from_env:
         self.env[key] = ()
 
+def install_dir(self, path):
+        if not path:
+                return []
+
+        destpath = Utils.subst_vars(path, self.env)
+
+        if self.is_install > 0:
+                Logs.info('* creating %s', destpath)
+                Utils.check_dir(destpath)
+        elif self.is_install < 0:
+                Logs.info('* removing %s', destpath)
+                try:
+                        os.remove(destpath)
+                except OSError:
+                        pass
+Build.BuildContext.install_dir = install_dir
+
 class ConfigurationContext(Configure.ConfigurationContext):
     def init_dirs(self):
         self.setenv('default')