Index: build/toolchain/gcc_ar_wrapper.py |
diff --git a/build/toolchain/gcc_ar_wrapper.py b/build/toolchain/gcc_ar_wrapper.py |
index de53df09e97582ab424b38c966beff262e8fd849..a8f319030761342125f5b0e0c775e1a8611ea4f4 100755 |
--- a/build/toolchain/gcc_ar_wrapper.py |
+++ b/build/toolchain/gcc_ar_wrapper.py |
@@ -16,7 +16,20 @@ |
import subprocess |
import sys |
-import wrapper_utils |
+ |
+# When running on a Windows host and using a toolchain whose tools are |
+# actually wrapper scripts (i.e. .bat files on Windows) rather than binary |
+# executables, the "command" to run has to be prefixed with this magic. |
+# The GN toolchain definitions take care of that for when GN/Ninja is |
+# running the tool directly. When that command is passed in to this |
+# script, it appears as a unitary string but needs to be split up so that |
+# just 'cmd' is the actual command given to Python's subprocess module. |
+BAT_PREFIX = 'cmd /c call ' |
+ |
+def CommandToRun(command): |
+ if command[0].startswith(BAT_PREFIX): |
+ command = command[0].split(None, 3) + command[1:] |
+ return command |
def main(): |
@@ -31,19 +44,11 @@ |
metavar='ARCHIVE') |
parser.add_argument('--plugin', |
help='Load plugin') |
- parser.add_argument('--resource-whitelist', |
- help='Merge all resource whitelists into a single file.', |
- metavar='PATH') |
parser.add_argument('operation', |
help='Operation on the archive') |
parser.add_argument('inputs', nargs='+', |
help='Input files') |
args = parser.parse_args() |
- |
- if args.resource_whitelist: |
- whitelist_candidates = wrapper_utils.ResolveRspLinks(args.inputs) |
- wrapper_utils.CombineResourceWhitelists( |
- whitelist_candidates, args.resource_whitelist) |
command = [args.ar, args.operation] |
if args.plugin is not None: |
@@ -59,7 +64,7 @@ |
raise |
# Now just run the ar command. |
- return subprocess.call(wrapper_utils.CommandToRun(command)) |
+ return subprocess.call(CommandToRun(command)) |
if __name__ == "__main__": |