Commit c9371699 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type/component_package,dynamic: implement PEP-0451

for pylint 3 to understand erp5 dynamic modules
parent 66f6fead
......@@ -222,6 +222,15 @@ class ComponentDynamicPackage(ModuleType):
if import_lock_held:
imp.acquire_lock()
def find_spec(self, name, path=None, target=None):
"""PEP-0451
"""
assert six.PY3
if self.find_module(name, path) is None:
return None
import importlib.util
return importlib.util.spec_from_loader(name, self)
def _getVersionPackage(self, version):
"""
Get the version package (NAMESPACE.VERSION_version) for the given version
......
......@@ -41,6 +41,17 @@ class PackageType(ModuleType):
"""
__path__ = []
def __init__(self, name, doc=None):
super(PackageType, self).__init__(name=name, doc=doc)
if six.PY3:
# PEP-0451
import importlib.machinery
self.__spec__ = importlib.machinery.ModuleSpec(
name=self.__name__,
loader=None,
)
class RefManager(dict):
"""
self[ComponentTool.last_sync] = (HTTP_REQUEST_WEAKSET,
......
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