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 import constants | 23 from pylib.constants import host_paths |
24 | 24 |
25 COLORAMA_ROOT = os.path.join(constants.DIR_SOURCE_ROOT, | 25 COLORAMA_ROOT = os.path.join(host_paths.DIR_SOURCE_ROOT, |
26 'third_party', 'colorama', 'src') | 26 'third_party', 'colorama', 'src') |
27 # aapt should ignore OWNERS files in addition the default ignore pattern. | 27 # aapt should ignore OWNERS files in addition the default ignore pattern. |
28 AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' + | 28 AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' + |
29 '!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp') | 29 '!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp') |
30 _HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0) | 30 _HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0) |
31 _HERMETIC_FILE_ATTR = (0644 << 16L) | 31 _HERMETIC_FILE_ATTR = (0644 << 16L) |
32 | 32 |
33 | 33 |
34 @contextlib.contextmanager | 34 @contextlib.contextmanager |
35 def TempDir(): | 35 def TempDir(): |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 """Gets the paths of imported non-system python modules. | 362 """Gets the paths of imported non-system python modules. |
363 | 363 |
364 A path is assumed to be a "system" import if it is outside of chromium's | 364 A path is assumed to be a "system" import if it is outside of chromium's |
365 src/. The paths will be relative to the current directory. | 365 src/. The paths will be relative to the current directory. |
366 """ | 366 """ |
367 module_paths = (m.__file__ for m in sys.modules.itervalues() | 367 module_paths = (m.__file__ for m in sys.modules.itervalues() |
368 if m is not None and hasattr(m, '__file__')) | 368 if m is not None and hasattr(m, '__file__')) |
369 | 369 |
370 abs_module_paths = map(os.path.abspath, module_paths) | 370 abs_module_paths = map(os.path.abspath, module_paths) |
371 | 371 |
372 assert os.path.isabs(constants.DIR_SOURCE_ROOT) | 372 assert os.path.isabs(host_paths.DIR_SOURCE_ROOT) |
373 non_system_module_paths = [ | 373 non_system_module_paths = [ |
374 p for p in abs_module_paths if p.startswith(constants.DIR_SOURCE_ROOT)] | 374 p for p in abs_module_paths if p.startswith(host_paths.DIR_SOURCE_ROOT)] |
375 def ConvertPycToPy(s): | 375 def ConvertPycToPy(s): |
376 if s.endswith('.pyc'): | 376 if s.endswith('.pyc'): |
377 return s[:-1] | 377 return s[:-1] |
378 return s | 378 return s |
379 | 379 |
380 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) | 380 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) |
381 non_system_module_paths = map(os.path.relpath, non_system_module_paths) | 381 non_system_module_paths = map(os.path.relpath, non_system_module_paths) |
382 return sorted(set(non_system_module_paths)) | 382 return sorted(set(non_system_module_paths)) |
383 | 383 |
384 | 384 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 md5_check.CallAndRecordIfStale( | 477 md5_check.CallAndRecordIfStale( |
478 on_stale_md5, | 478 on_stale_md5, |
479 record_path=record_path, | 479 record_path=record_path, |
480 input_paths=input_paths, | 480 input_paths=input_paths, |
481 input_strings=input_strings, | 481 input_strings=input_strings, |
482 output_paths=output_paths, | 482 output_paths=output_paths, |
483 force=force, | 483 force=force, |
484 pass_changes=True) | 484 pass_changes=True) |
485 | 485 |
OLD | NEW |