##// END OF EJS Templates
demandimport: move ignore list to __init__.py...
Siddharth Agarwal -
r32422:f37f9499 default
parent child Browse files
Show More
@@ -13,10 +13,57 b''
13
13
14 from __future__ import absolute_import
14 from __future__ import absolute_import
15
15
16 import sys
17
16 from . import demandimportpy2 as demandimport
18 from . import demandimportpy2 as demandimport
17
19
20 # Extensions can add to this list if necessary.
21 ignore = [
22 '__future__',
23 '_hashlib',
24 # ImportError during pkg_resources/__init__.py:fixup_namespace_package
25 '_imp',
26 '_xmlplus',
27 'fcntl',
28 'nt', # pathlib2 tests the existence of built-in 'nt' module
29 'win32com.gen_py',
30 'win32com.shell', # 'appdirs' tries to import win32com.shell
31 '_winreg', # 2.7 mimetypes needs immediate ImportError
32 'pythoncom',
33 # imported by tarfile, not available under Windows
34 'pwd',
35 'grp',
36 # imported by profile, itself imported by hotshot.stats,
37 # not available under Windows
38 'resource',
39 # this trips up many extension authors
40 'gtk',
41 # setuptools' pkg_resources.py expects "from __main__ import x" to
42 # raise ImportError if x not defined
43 '__main__',
44 '_ssl', # conditional imports in the stdlib, issue1964
45 '_sre', # issue4920
46 'rfc822',
47 'mimetools',
48 'sqlalchemy.events', # has import-time side effects (issue5085)
49 # setuptools 8 expects this module to explode early when not on windows
50 'distutils.msvc9compiler',
51 '__builtin__',
52 'builtins',
53 'urwid.command_map', # for pudb
54 ]
55
56 _pypy = '__pypy__' in sys.builtin_module_names
57
58 if _pypy:
59 ignore.extend([
60 # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5)
61 '_ctypes.pointer',
62 ])
63
64 demandimport.init(ignore)
65
18 # Re-export.
66 # Re-export.
19 ignore = demandimport.ignore
20 isenabled = demandimport.isenabled
67 isenabled = demandimport.isenabled
21 enable = demandimport.enable
68 enable = demandimport.enable
22 disable = demandimport.disable
69 disable = demandimport.disable
@@ -265,46 +265,11 b' def _demandimport(name, globals=None, lo'
265
265
266 return mod
266 return mod
267
267
268 ignore = [
268 ignore = []
269 '__future__',
270 '_hashlib',
271 # ImportError during pkg_resources/__init__.py:fixup_namespace_package
272 '_imp',
273 '_xmlplus',
274 'fcntl',
275 'nt', # pathlib2 tests the existence of built-in 'nt' module
276 'win32com.gen_py',
277 'win32com.shell', # 'appdirs' tries to import win32com.shell
278 '_winreg', # 2.7 mimetypes needs immediate ImportError
279 'pythoncom',
280 # imported by tarfile, not available under Windows
281 'pwd',
282 'grp',
283 # imported by profile, itself imported by hotshot.stats,
284 # not available under Windows
285 'resource',
286 # this trips up many extension authors
287 'gtk',
288 # setuptools' pkg_resources.py expects "from __main__ import x" to
289 # raise ImportError if x not defined
290 '__main__',
291 '_ssl', # conditional imports in the stdlib, issue1964
292 '_sre', # issue4920
293 'rfc822',
294 'mimetools',
295 'sqlalchemy.events', # has import-time side effects (issue5085)
296 # setuptools 8 expects this module to explode early when not on windows
297 'distutils.msvc9compiler',
298 '__builtin__',
299 'builtins',
300 'urwid.command_map', # for pudb
301 ]
302
269
303 if _pypy:
270 def init(ignorelist):
304 ignore.extend([
271 global ignore
305 # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5)
272 ignore = ignorelist
306 '_ctypes.pointer',
307 ])
308
273
309 def isenabled():
274 def isenabled():
310 return builtins.__import__ == _demandimport
275 return builtins.__import__ == _demandimport
General Comments 0
You need to be logged in to leave comments. Login now