From 4516d87036f971a4c98900301b6354c0aae73dc8 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Sun, 21 Jun 2020 16:39:53 -0600 Subject: Use importlib instead of imp in __bootstrap__ functions --- setuptools/command/bdist_egg.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'setuptools/command/bdist_egg.py') diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 1b28d4c9..e94fe252 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -55,10 +55,11 @@ def write_stub(resource, pyfile): _stub_template = textwrap.dedent(""" def __bootstrap__(): global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp + import sys, pkg_resources + from importlib.machinery import ExtensionFileLoader __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) + ExtensionFileLoader(__name__,__file__).exec_module() __bootstrap__() """).lstrip() with open(pyfile, 'w') as f: -- cgit v1.2.3