Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: pnacl/driver/driver_tools.py

Issue 2076883004: Fix driver_tools.py to handle the case when command file is empty. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import platform 6 import platform
7 import os 7 import os
8 import random 8 import random
9 import re 9 import re
10 import shlex 10 import shlex
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 def ParseArgsBase(argv, patternlist): 353 def ParseArgsBase(argv, patternlist):
354 """ Parse argv using the patterns in patternlist 354 """ Parse argv using the patterns in patternlist
355 Returns: (matched, unmatched) 355 Returns: (matched, unmatched)
356 """ 356 """
357 matched = [] 357 matched = []
358 unmatched = [] 358 unmatched = []
359 i = 0 359 i = 0
360 while i < len(argv): 360 while i < len(argv):
361 if ShouldExpandCommandFile(argv[i]): 361 if ShouldExpandCommandFile(argv[i]):
362 argv = DoExpandCommandFile(argv, i) 362 argv = DoExpandCommandFile(argv, i)
363 if i >= len(argv):
364 break
363 num_matched, action, groups = MatchOne(argv, i, patternlist) 365 num_matched, action, groups = MatchOne(argv, i, patternlist)
364 if num_matched == 0: 366 if num_matched == 0:
365 unmatched.append(argv[i]) 367 unmatched.append(argv[i])
366 i += 1 368 i += 1
367 continue 369 continue
368 matched += argv[i:i+num_matched] 370 matched += argv[i:i+num_matched]
369 if isinstance(action, str): 371 if isinstance(action, str):
370 # Perform $N substitution 372 # Perform $N substitution
371 for g in xrange(0, len(groups)): 373 for g in xrange(0, len(groups)):
372 action = action.replace('$%d' % g, 'groups[%d]' % g) 374 action = action.replace('$%d' % g, 'groups[%d]' % g)
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 # Last step 882 # Last step
881 step_output = self.output 883 step_output = self.output
882 else: 884 else:
883 # Intermediate step 885 # Intermediate step
884 if self.use_names_for_input: 886 if self.use_names_for_input:
885 step_output = self.namegen.TempNameForInput(self.input, output_type) 887 step_output = self.namegen.TempNameForInput(self.input, output_type)
886 else: 888 else:
887 step_output = self.namegen.TempNameForOutput(output_type) 889 step_output = self.namegen.TempNameForOutput(output_type)
888 callback(step_input, step_output, **extra) 890 callback(step_input, step_output, **extra)
889 step_input = step_output 891 step_input = step_output
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698