Mercurial > public > mercurial-scm > hg
diff hgdemandimport/demandimportpy2.py @ 32422:f37f9499fea8
demandimport: move ignore list to __init__.py
We're going to use the same ignore list for Python 3.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 21 May 2017 12:10:53 -0700 |
parents | 0906b85bf222 |
children | 847233374434 |
line wrap: on
line diff
--- a/hgdemandimport/demandimportpy2.py Sun May 21 13:44:26 2017 -0700 +++ b/hgdemandimport/demandimportpy2.py Sun May 21 12:10:53 2017 -0700 @@ -265,46 +265,11 @@ return mod -ignore = [ - '__future__', - '_hashlib', - # ImportError during pkg_resources/__init__.py:fixup_namespace_package - '_imp', - '_xmlplus', - 'fcntl', - 'nt', # pathlib2 tests the existence of built-in 'nt' module - 'win32com.gen_py', - 'win32com.shell', # 'appdirs' tries to import win32com.shell - '_winreg', # 2.7 mimetypes needs immediate ImportError - 'pythoncom', - # imported by tarfile, not available under Windows - 'pwd', - 'grp', - # imported by profile, itself imported by hotshot.stats, - # not available under Windows - 'resource', - # this trips up many extension authors - 'gtk', - # setuptools' pkg_resources.py expects "from __main__ import x" to - # raise ImportError if x not defined - '__main__', - '_ssl', # conditional imports in the stdlib, issue1964 - '_sre', # issue4920 - 'rfc822', - 'mimetools', - 'sqlalchemy.events', # has import-time side effects (issue5085) - # setuptools 8 expects this module to explode early when not on windows - 'distutils.msvc9compiler', - '__builtin__', - 'builtins', - 'urwid.command_map', # for pudb - ] +ignore = [] -if _pypy: - ignore.extend([ - # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5) - '_ctypes.pointer', - ]) +def init(ignorelist): + global ignore + ignore = ignorelist def isenabled(): return builtins.__import__ == _demandimport