| OLD | NEW |
| 1 import os |
| 1 import subprocess | 2 import subprocess |
| 2 import sys | 3 import sys |
| 3 | 4 |
| 4 def shellcmd(command, echo=True): | 5 def shellcmd(command, echo=True): |
| 5 if echo: print '[cmd]', command | 6 if echo: print '[cmd]', command |
| 6 | 7 |
| 7 if not isinstance(command, str): | 8 if not isinstance(command, str): |
| 8 command = ' '.join(command) | 9 command = ' '.join(command) |
| 9 | 10 |
| 10 stdout_result = subprocess.check_output(command, shell=True) | 11 stdout_result = subprocess.check_output(command, shell=True) |
| 11 if echo: sys.stdout.write(stdout_result) | 12 if echo: sys.stdout.write(stdout_result) |
| 12 return stdout_result | 13 return stdout_result |
| 14 |
| 15 def FindBaseNaCl(): |
| 16 """Find the base native_client/ directory.""" |
| 17 nacl = 'native_client' |
| 18 path_list = os.getcwd().split(os.sep) |
| 19 if nacl not in path_list: |
| 20 return None |
| 21 last_index = len(path_list) - path_list[::-1].index(nacl) |
| 22 return os.sep.join(path_list[:last_index]) |
| OLD | NEW |