OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 os | 5 import os |
6 import sys | 6 import sys |
7 | 7 |
8 | 8 |
9 def _add_ext_dirs_to_path(): | 9 def _add_ext_dirs_to_path(): |
10 base = os.path.dirname(os.path.abspath(__file__)) | 10 base = os.path.dirname(os.path.abspath(__file__)) |
(...skipping 11 matching lines...) Expand all Loading... |
22 # imports, but doesn't make python import them immediately at runtime. | 22 # imports, but doesn't make python import them immediately at runtime. |
23 # | 23 # |
24 # This list should always contain a complete list of all modules in ext. | 24 # This list should always contain a complete list of all modules in ext. |
25 if False: | 25 if False: |
26 import requests | 26 import requests |
27 import argcomplete | 27 import argcomplete |
28 import testing_support | 28 import testing_support |
29 | 29 |
30 | 30 |
31 class _LazyImportHack(object): | 31 class _LazyImportHack(object): |
| 32 __path__ = [] |
32 | 33 |
33 def __getattr__(self, name): | 34 def __getattr__(self, name): |
34 mod = __import__(name) | 35 mod = __import__(name) |
35 setattr(self, name, mod) | 36 setattr(self, name, mod) |
36 return mod | 37 return mod |
37 | 38 |
38 sys.modules[__name__] = _LazyImportHack() | 39 sys.modules[__name__] = _LazyImportHack() |
OLD | NEW |