selftest/tests.py: Update path to waflib
[bbaumbach/samba-autobuild/.git] / third_party / waf / wafadmin / 3rdparty / print_commands.py
1 #! /usr/bin/env python
2
3 """
4 In this case, print the commands being executed as strings
5 (the commands are usually lists, so this can be misleading)
6 """
7
8 import Build, Utils, Logs
9
10 def exec_command(self, cmd, **kw):
11         txt = cmd
12         if isinstance(cmd, list):
13                 txt = ' '.join(cmd)
14         Logs.debug('runner: %s' % txt)
15         if self.log:
16                 self.log.write('%s\n' % cmd)
17                 kw['log'] = self.log
18         try:
19                 if not kw.get('cwd', None):
20                         kw['cwd'] = self.cwd
21         except AttributeError:
22                 self.cwd = kw['cwd'] = self.bldnode.abspath()
23         return Utils.exec_command(cmd, **kw)
24 Build.BuildContext.exec_command = exec_command
25