OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import ast | 5 import ast |
6 import contextlib | 6 import contextlib |
7 import fnmatch | 7 import fnmatch |
8 import json | 8 import json |
9 import os | 9 import os |
10 import pipes | 10 import pipes |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 if s.endswith('.pyc'): | 316 if s.endswith('.pyc'): |
317 return s[:-1] | 317 return s[:-1] |
318 return s | 318 return s |
319 | 319 |
320 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) | 320 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) |
321 non_system_module_paths = map(os.path.relpath, non_system_module_paths) | 321 non_system_module_paths = map(os.path.relpath, non_system_module_paths) |
322 return sorted(set(non_system_module_paths)) | 322 return sorted(set(non_system_module_paths)) |
323 | 323 |
324 | 324 |
325 def AddDepfileOption(parser): | 325 def AddDepfileOption(parser): |
326 parser.add_option('--depfile', | 326 # TODO(agrieve): Get rid of this once we've moved to argparse. |
327 help='Path to depfile. This must be specified as the ' | 327 if hasattr(parser, 'add_option'): |
328 'action\'s first output.') | 328 func = parser.add_option |
| 329 else: |
| 330 func = parser.add_argument |
| 331 func('--depfile', |
| 332 help='Path to depfile. Must be specified as the action\'s first output.') |
329 | 333 |
330 | 334 |
331 def WriteDepfile(path, dependencies): | 335 def WriteDepfile(path, dependencies): |
332 with open(path, 'w') as depfile: | 336 with open(path, 'w') as depfile: |
333 depfile.write(path) | 337 depfile.write(path) |
334 depfile.write(': ') | 338 depfile.write(': ') |
335 depfile.write(' '.join(dependencies)) | 339 depfile.write(' '.join(dependencies)) |
336 depfile.write('\n') | 340 depfile.write('\n') |
337 | 341 |
338 | 342 |
(...skipping 28 matching lines...) Expand all Loading... |
367 file_jsons[file_path] = ReadJson(file_path) | 371 file_jsons[file_path] = ReadJson(file_path) |
368 | 372 |
369 expansion = file_jsons[file_path] | 373 expansion = file_jsons[file_path] |
370 for k in lookup_path[1:]: | 374 for k in lookup_path[1:]: |
371 expansion = expansion[k] | 375 expansion = expansion[k] |
372 | 376 |
373 new_args[i] = arg[:match.start()] + str(expansion) | 377 new_args[i] = arg[:match.start()] + str(expansion) |
374 | 378 |
375 return new_args | 379 return new_args |
376 | 380 |
OLD | NEW |