OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Class capturing a command invocation as data.""" | 6 """Class capturing a command invocation as data.""" |
7 | 7 |
8 import inspect | 8 import inspect |
9 import glob | 9 import glob |
10 import hashlib | 10 import hashlib |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 cwd = subst.SubstituteAbsPaths(check_call_kwargs.get('cwd', '.')) | 189 cwd = subst.SubstituteAbsPaths(check_call_kwargs.get('cwd', '.')) |
190 subst.SetCwd(cwd) | 190 subst.SetCwd(cwd) |
191 check_call_kwargs['cwd'] = cwd | 191 check_call_kwargs['cwd'] = cwd |
192 | 192 |
193 # Extract paths from kwargs and add to the command environment. | 193 # Extract paths from kwargs and add to the command environment. |
194 path_dirs = [] | 194 path_dirs = [] |
195 if 'path_dirs' in check_call_kwargs: | 195 if 'path_dirs' in check_call_kwargs: |
196 path_dirs = [subst.Substitute(dirname) for dirname | 196 path_dirs = [subst.Substitute(dirname) for dirname |
197 in check_call_kwargs['path_dirs']] | 197 in check_call_kwargs['path_dirs']] |
198 del check_call_kwargs['path_dirs'] | 198 del check_call_kwargs['path_dirs'] |
199 check_call_kwargs['env'] = PlatformEnvironment(path_dirs) | 199 # Perform substitution on any env overrides. |
200 if 'env' in check_call_kwargs: | |
201 check_call_kwargs['env'] = { k: subst.Substitute(v) | |
202 for (k, v) in check_call_kwargs['env'].iteritems() } | |
203 check_call_kwargs['env'].update(PlatformEnvironment(path_dirs)) | |
Derek Schuff
2015/03/10 21:09:45
can you do a run with --emit-signatures=foo and en
jvoung (off chromium)
2015/03/10 22:30:18
The "foo" file has:
=============================
| |
204 else: | |
205 check_call_kwargs['env'] = PlatformEnvironment(path_dirs) | |
200 | 206 |
201 if isinstance(command, str): | 207 if isinstance(command, str): |
202 command = subst.Substitute(command) | 208 command = subst.Substitute(command) |
203 else: | 209 else: |
204 command = [subst.Substitute(arg) for arg in command] | 210 command = [subst.Substitute(arg) for arg in command] |
205 paths = check_call_kwargs['env']['PATH'].split(os.pathsep) | 211 paths = check_call_kwargs['env']['PATH'].split(os.pathsep) |
206 command[0] = pynacl.file_tools.Which(command[0], paths=paths) | 212 command[0] = pynacl.file_tools.Which(command[0], paths=paths) |
207 | 213 |
208 if stdout is not None: | 214 if stdout is not None: |
209 stdout = subst.SubstituteAbsPaths(stdout) | 215 stdout = subst.SubstituteAbsPaths(stdout) |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 # It describes how to unpack and apply patches to produce the source | 594 # It describes how to unpack and apply patches to produce the source |
589 # tree of the %(name)s component of a toolchain targetting Native Client. | 595 # tree of the %(name)s component of a toolchain targetting Native Client. |
590 | 596 |
591 # Source: %(upstream-name)s.tar | 597 # Source: %(upstream-name)s.tar |
592 """ | 598 """ |
593 % info) | 599 % info) |
594 for patch in patch_files: | 600 for patch in patch_files: |
595 f.write('\n# %s\n%s\n' % patch) | 601 f.write('\n# %s\n%s\n' % patch) |
596 | 602 |
597 return Runnable(run_cond, generatePatches, git_dir, info) | 603 return Runnable(run_cond, generatePatches, git_dir, info) |
OLD | NEW |