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 |
11 import re | 11 import re |
12 import shlex | 12 import shlex |
13 import shutil | 13 import shutil |
14 import subprocess | 14 import subprocess |
15 import sys | 15 import sys |
16 import tempfile | 16 import tempfile |
17 import zipfile | 17 import zipfile |
18 | 18 |
19 # Some clients do not add //build/android/gyp to PYTHONPATH. | 19 # Some clients do not add //build/android/gyp to PYTHONPATH. |
20 import md5_check # pylint: disable=relative-import | 20 import md5_check # pylint: disable=relative-import |
21 | 21 |
22 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) | 22 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) |
23 from pylib.constants import host_paths | 23 from pylib.constants import host_paths |
24 | 24 |
| 25 sys.path.append(os.path.join(os.path.dirname(__file__), |
| 26 os.pardir, os.pardir, os.pardir)) |
| 27 import gn_helpers |
| 28 |
25 COLORAMA_ROOT = os.path.join(host_paths.DIR_SOURCE_ROOT, | 29 COLORAMA_ROOT = os.path.join(host_paths.DIR_SOURCE_ROOT, |
26 'third_party', 'colorama', 'src') | 30 'third_party', 'colorama', 'src') |
27 # aapt should ignore OWNERS files in addition the default ignore pattern. | 31 # aapt should ignore OWNERS files in addition the default ignore pattern. |
28 AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' + | 32 AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' + |
29 '!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp') | 33 '!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp') |
30 _HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0) | 34 _HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0) |
31 _HERMETIC_FILE_ATTR = (0644 << 16L) | 35 _HERMETIC_FILE_ATTR = (0644 << 16L) |
32 | 36 |
33 | 37 |
34 @contextlib.contextmanager | 38 @contextlib.contextmanager |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 74 |
71 | 75 |
72 def FindInDirectories(directories, filename_filter): | 76 def FindInDirectories(directories, filename_filter): |
73 all_files = [] | 77 all_files = [] |
74 for directory in directories: | 78 for directory in directories: |
75 all_files.extend(FindInDirectory(directory, filename_filter)) | 79 all_files.extend(FindInDirectory(directory, filename_filter)) |
76 return all_files | 80 return all_files |
77 | 81 |
78 | 82 |
79 def ParseGnList(gn_string): | 83 def ParseGnList(gn_string): |
80 # TODO(brettw) bug 573132: This doesn't handle GN escaping properly, so any | 84 parser = gn_helpers.GNValueParser(gn_string) |
81 # weird characters like $ or \ in the strings will be corrupted. | 85 return parser.ParseList() |
82 # | |
83 # The code should import build/gn_helpers.py and then do: | |
84 # parser = gn_helpers.GNValueParser(gn_string) | |
85 # return return parser.ParseList() | |
86 # As of this writing, though, there is a CastShell build script that sends | |
87 # JSON through this function, and using correct GN parsing corrupts that. | |
88 # | |
89 # We need to be consistent about passing either JSON or GN lists through | |
90 # this function. | |
91 return ast.literal_eval(gn_string) | |
92 | 86 |
93 | 87 |
94 def ParseGypList(gyp_string): | 88 def ParseGypList(gyp_string): |
95 # The ninja generator doesn't support $ in strings, so use ## to | 89 # The ninja generator doesn't support $ in strings, so use ## to |
96 # represent $. | 90 # represent $. |
97 # TODO(cjhopman): Remove when | 91 # TODO(cjhopman): Remove when |
98 # https://code.google.com/p/gyp/issues/detail?id=327 | 92 # https://code.google.com/p/gyp/issues/detail?id=327 |
99 # is addressed. | 93 # is addressed. |
100 gyp_string = gyp_string.replace('##', '$') | 94 gyp_string = gyp_string.replace('##', '$') |
101 | 95 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 481 |
488 md5_check.CallAndRecordIfStale( | 482 md5_check.CallAndRecordIfStale( |
489 on_stale_md5, | 483 on_stale_md5, |
490 record_path=record_path, | 484 record_path=record_path, |
491 input_paths=input_paths, | 485 input_paths=input_paths, |
492 input_strings=input_strings, | 486 input_strings=input_strings, |
493 output_paths=output_paths, | 487 output_paths=output_paths, |
494 force=force, | 488 force=force, |
495 pass_changes=True) | 489 pass_changes=True) |
496 | 490 |
OLD | NEW |