Show More
@@ -13,6 +13,7 b'' | |||
|
13 | 13 | |
|
14 | 14 | from __future__ import absolute_import |
|
15 | 15 | |
|
16 | import os | |
|
16 | 17 | import sys |
|
17 | 18 | |
|
18 | 19 | if sys.version_info[0] >= 3: |
@@ -68,6 +69,9 b' demandimport.init(ignore)' | |||
|
68 | 69 | |
|
69 | 70 | # Re-export. |
|
70 | 71 | isenabled = demandimport.isenabled |
|
71 | enable = demandimport.enable | |
|
72 | 72 | disable = demandimport.disable |
|
73 | 73 | deactivated = demandimport.deactivated |
|
74 | ||
|
75 | def enable(): | |
|
76 | if os.environ.get('HGDEMANDIMPORT') != 'disable': | |
|
77 | demandimport.enable() |
@@ -28,7 +28,6 b' from __future__ import absolute_import' | |||
|
28 | 28 | |
|
29 | 29 | import __builtin__ as builtins |
|
30 | 30 | import contextlib |
|
31 | import os | |
|
32 | 31 | import sys |
|
33 | 32 | |
|
34 | 33 | contextmanager = contextlib.contextmanager |
@@ -285,8 +284,7 b' def isenabled():' | |||
|
285 | 284 | |
|
286 | 285 | def enable(): |
|
287 | 286 | "enable global demand-loading of modules" |
|
288 | if os.environ.get('HGDEMANDIMPORT') != 'disable': | |
|
289 | builtins.__import__ = _demandimport | |
|
287 | builtins.__import__ = _demandimport | |
|
290 | 288 | |
|
291 | 289 | def disable(): |
|
292 | 290 | "disable global demand-loading of modules" |
@@ -27,7 +27,6 b' This also has some limitations compared ' | |||
|
27 | 27 | from __future__ import absolute_import |
|
28 | 28 | |
|
29 | 29 | import contextlib |
|
30 | import os | |
|
31 | 30 | import sys |
|
32 | 31 | |
|
33 | 32 | import importlib.abc |
@@ -81,8 +80,7 b' def disable():' | |||
|
81 | 80 | pass |
|
82 | 81 | |
|
83 | 82 | def enable(): |
|
84 | if os.environ.get('HGDEMANDIMPORT') != 'disable': | |
|
85 | sys.path_hooks.insert(0, _makefinder) | |
|
83 | sys.path_hooks.insert(0, _makefinder) | |
|
86 | 84 | |
|
87 | 85 | @contextlib.contextmanager |
|
88 | 86 | def deactivated(): |
General Comments 0
You need to be logged in to leave comments.
Login now