build:wafsamba: Include the print_commands.py tool from upstream
authorThomas Nagy <tnagy@waf.io>
Thu, 5 Nov 2015 17:57:14 +0000 (18:57 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 6 Nov 2015 09:37:24 +0000 (10:37 +0100)
The tool 'print_commands' is provided by default in Waf 1.8. Keeping
the old code in Samba complicates the Waf upgrade.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Uri Simchoni uri@samba.org
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
third_party/waf/wafadmin/3rdparty/print_commands.py [new file with mode: 0644]

diff --git a/third_party/waf/wafadmin/3rdparty/print_commands.py b/third_party/waf/wafadmin/3rdparty/print_commands.py
new file mode 100644 (file)
index 0000000..3b12aa3
--- /dev/null
@@ -0,0 +1,25 @@
+#! /usr/bin/env python
+
+"""
+In this case, print the commands being executed as strings
+(the commands are usually lists, so this can be misleading)
+"""
+
+import Build, Utils, Logs
+
+def exec_command(self, cmd, **kw):
+       txt = cmd
+       if isinstance(cmd, list):
+               txt = ' '.join(cmd)
+       Logs.debug('runner: %s' % txt)
+       if self.log:
+               self.log.write('%s\n' % cmd)
+               kw['log'] = self.log
+       try:
+               if not kw.get('cwd', None):
+                       kw['cwd'] = self.cwd
+       except AttributeError:
+               self.cwd = kw['cwd'] = self.bldnode.abspath()
+       return Utils.exec_command(cmd, **kw)
+Build.BuildContext.exec_command = exec_command
+