Ignore more Python warnings when importing in earlyinit

With a17c4767d6 we moved the first time
pkg_resources is imported to earlyinit.py, which means less warnings were
suppressed.

Fixes #2990
This commit is contained in:
Florian Bruhin 2017-09-21 23:24:22 +02:00
parent cd9fe57d84
commit f4017eb5b6

View File

@ -218,7 +218,14 @@ def _check_modules(modules):
'Flags not at the start of the expression']
with log.ignore_py_warnings(
category=DeprecationWarning,
message=r'({})'.format('|'.join(messages))):
message=r'({})'.format('|'.join(messages))
), log.ignore_py_warnings(
category=PendingDeprecationWarning,
module='imp'
), log.ignore_py_warnings(
category=ImportWarning,
message=r'Not importing directory .*: missing __init__'
):
importlib.import_module(name)
except ImportError as e:
_die(text, e)