Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import os.path | 8 import os.path |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 the main compiler driver and the linker driver, then invokes all the | 45 the main compiler driver and the linker driver, then invokes all the |
| 46 required tools. | 46 required tools. |
| 47 | 47 |
| 48 Args: | 48 Args: |
| 49 args: list of string, Arguments to the script. | 49 args: list of string, Arguments to the script. |
| 50 """ | 50 """ |
| 51 | 51 |
| 52 if len(args) < 2: | 52 if len(args) < 2: |
| 53 raise RuntimeError("Usage: linker_driver.py [linker-invocation]") | 53 raise RuntimeError("Usage: linker_driver.py [linker-invocation]") |
| 54 | 54 |
| 55 if args[1] == "--developer_dir": | |
| 56 os.environ['DEVELOPER_DIR'] = args[2] | |
| 57 del args[2] | |
|
justincohen
2016/10/26 00:36:48
I didn't want to change linker_driver to something
sdefresne
2016/10/26 15:33:07
Can you instead iterate over the arguments then?
justincohen
2016/10/27 13:36:39
Done.
| |
| 58 del args[1] | |
| 59 | |
| 55 # Collect arguments to the linker driver (this script) and remove them from | 60 # Collect arguments to the linker driver (this script) and remove them from |
| 56 # the arguments being passed to the compiler driver. | 61 # the arguments being passed to the compiler driver. |
| 57 linker_driver_actions = {} | 62 linker_driver_actions = {} |
| 58 compiler_driver_args = [] | 63 compiler_driver_args = [] |
| 59 for arg in args[1:]: | 64 for arg in args[1:]: |
| 60 if arg.startswith(_LINKER_DRIVER_ARG_PREFIX): | 65 if arg.startswith(_LINKER_DRIVER_ARG_PREFIX): |
| 61 # Convert driver actions into a map of name => lambda to invoke. | 66 # Convert driver actions into a map of name => lambda to invoke. |
| 62 driver_action = ProcessLinkerDriverArg(arg) | 67 driver_action = ProcessLinkerDriverArg(arg) |
| 63 assert driver_action[0] not in linker_driver_actions | 68 assert driver_action[0] not in linker_driver_actions |
| 64 linker_driver_actions[driver_action[0]] = driver_action[1] | 69 linker_driver_actions[driver_action[0]] = driver_action[1] |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 _LINKER_DRIVER_ACTIONS = [ | 219 _LINKER_DRIVER_ACTIONS = [ |
| 215 ('dsym,', RunDsymUtil), | 220 ('dsym,', RunDsymUtil), |
| 216 ('unstripped,', RunSaveUnstripped), | 221 ('unstripped,', RunSaveUnstripped), |
| 217 ('strip,', RunStrip), | 222 ('strip,', RunStrip), |
| 218 ] | 223 ] |
| 219 | 224 |
| 220 | 225 |
| 221 if __name__ == '__main__': | 226 if __name__ == '__main__': |
| 222 Main(sys.argv) | 227 Main(sys.argv) |
| 223 sys.exit(0) | 228 sys.exit(0) |
| OLD | NEW |