| Index: build/android/gyp/util/build_utils.py
|
| diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
|
| index 65bd07b351ca6aaaf65b5f4a8aa050145d99d8f9..8b395131c57f2d45643c5cfef80d7dbdda98ff87 100644
|
| --- a/build/android/gyp/util/build_utils.py
|
| +++ b/build/android/gyp/util/build_utils.py
|
| @@ -406,8 +406,7 @@ def GetPythonDependencies():
|
| A path is assumed to be a "system" import if it is outside of chromium's
|
| src/. The paths will be relative to the current directory.
|
| """
|
| - module_paths = (m.__file__ for m in sys.modules.itervalues()
|
| - if m is not None and hasattr(m, '__file__'))
|
| + module_paths = GetModulePaths()
|
|
|
| abs_module_paths = map(os.path.abspath, module_paths)
|
|
|
| @@ -424,6 +423,30 @@ def GetPythonDependencies():
|
| return sorted(set(non_system_module_paths))
|
|
|
|
|
| +def GetModulePaths():
|
| + """Returns the paths to all of the modules in sys.modules."""
|
| + ForceLazyModulesToLoad()
|
| + return (m.__file__ for m in sys.modules.itervalues()
|
| + if m is not None and hasattr(m, '__file__'))
|
| +
|
| +
|
| +def ForceLazyModulesToLoad():
|
| + """Forces any lazily imported modules to fully load themselves.
|
| +
|
| + Inspecting the modules' __file__ attribute causes lazily imported modules
|
| + (e.g. from email) to get fully imported and update sys.modules. Iterate
|
| + over the values until sys.modules stabilizes so that no modules are missed.
|
| + """
|
| + while True:
|
| + num_modules_before = len(sys.modules.keys())
|
| + for m in sys.modules.values():
|
| + if m is not None and hasattr(m, '__file__'):
|
| + _ = m.__file__
|
| + num_modules_after = len(sys.modules.keys())
|
| + if num_modules_before == num_modules_after:
|
| + break
|
| +
|
| +
|
| def AddDepfileOption(parser):
|
| # TODO(agrieve): Get rid of this once we've moved to argparse.
|
| if hasattr(parser, 'add_option'):
|
|
|