Chromium Code Reviews| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 def GetPythonDependencies(): | 331 def GetPythonDependencies(): |
| 332 """Gets the paths of imported non-system python modules. | 332 """Gets the paths of imported non-system python modules. |
| 333 | 333 |
| 334 A path is assumed to be a "system" import if it is outside of chromium's | 334 A path is assumed to be a "system" import if it is outside of chromium's |
| 335 src/. The paths will be relative to the current directory. | 335 src/. The paths will be relative to the current directory. |
| 336 """ | 336 """ |
| 337 module_paths = (m.__file__ for m in sys.modules.itervalues() | 337 module_paths = (m.__file__ for m in sys.modules.itervalues() |
| 338 if m is not None and hasattr(m, '__file__')) | 338 if m is not None and hasattr(m, '__file__')) |
| 339 | 339 |
| 340 abs_module_paths = map(os.path.abspath, module_paths) | 340 abs_module_paths = map(os.path.abspath, module_paths) |
| 341 abs_root = os.path.abspath(CHROMIUM_SRC) | |
|
agrieve
2015/10/30 00:11:45
I think it'd be even better to make CHROMIUM_SRC a
agrieve
2015/10/30 00:25:06
Actually - almost everywhere actually uses DIR_SOU
tsniatowski
2015/10/30 00:31:21
The problem is when someone goes and changes it ba
| |
| 341 | 342 |
| 342 non_system_module_paths = [ | 343 non_system_module_paths = [ |
| 343 p for p in abs_module_paths if p.startswith(CHROMIUM_SRC)] | 344 p for p in abs_module_paths if p.startswith(abs_root)] |
| 344 def ConvertPycToPy(s): | 345 def ConvertPycToPy(s): |
| 345 if s.endswith('.pyc'): | 346 if s.endswith('.pyc'): |
| 346 return s[:-1] | 347 return s[:-1] |
| 347 return s | 348 return s |
| 348 | 349 |
| 349 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) | 350 non_system_module_paths = map(ConvertPycToPy, non_system_module_paths) |
| 350 non_system_module_paths = map(os.path.relpath, non_system_module_paths) | 351 non_system_module_paths = map(os.path.relpath, non_system_module_paths) |
| 351 return sorted(set(non_system_module_paths)) | 352 return sorted(set(non_system_module_paths)) |
| 352 | 353 |
| 353 | 354 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 | 446 |
| 446 md5_check.CallAndRecordIfStale( | 447 md5_check.CallAndRecordIfStale( |
| 447 on_stale_md5, | 448 on_stale_md5, |
| 448 record_path=record_path, | 449 record_path=record_path, |
| 449 input_paths=input_paths, | 450 input_paths=input_paths, |
| 450 input_strings=input_strings, | 451 input_strings=input_strings, |
| 451 output_paths=output_paths, | 452 output_paths=output_paths, |
| 452 force=force, | 453 force=force, |
| 453 pass_changes=True) | 454 pass_changes=True) |
| 454 | 455 |
| OLD | NEW |