Commit 8fa9a864 authored by Jason R. Coombs's avatar Jason R. Coombs

Only import modules when they're expected to be present

parent 6070cc15
......@@ -43,9 +43,11 @@ class Installer:
return self.target
_nspkg_tmpl = (
"import sys, types, os, importlib.util, importlib.machinery",
"import sys, types, os",
"has_mfs = sys.version_info > (3, 5)",
"p = os.path.join(%(root)s, *%(pth)r)",
"importlib = has_mfs and __import__('importlib.util')",
"has_mfs and __import__('importlib.machinery')",
"m = has_mfs and "
"sys.modules.setdefault(%(pkg)r, "
"importlib.util.module_from_spec("
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment