aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider/script_host.py
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/autoload/provider/script_host.py')
-rw-r--r--runtime/autoload/provider/script_host.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py
index e0b9ee6012..c600cff234 100644
--- a/runtime/autoload/provider/script_host.py
+++ b/runtime/autoload/provider/script_host.py
@@ -17,6 +17,9 @@ IS_PYTHON3 = sys.version_info >= (3, 0)
if IS_PYTHON3:
basestring = str
+ if sys.version_info >= (3, 4):
+ from importlib.machinery import PathFinder
+
@neovim.plugin
class ScriptHost(object):
@@ -212,8 +215,9 @@ def path_hook(nvim):
return self.module
class VimPathFinder(object):
- @classmethod
- def find_module(cls, fullname, path=None):
+ @staticmethod
+ def find_module(fullname, path=None):
+ "Method for Python 2.7 and 3.3."
try:
return VimModuleLoader(
_find_module(fullname, fullname, path or _get_paths()))
@@ -224,6 +228,11 @@ def path_hook(nvim):
def load_module(cls, fullname, path=None):
return _find_module(fullname, fullname, path or _get_paths())
+ @staticmethod
+ def find_spec(fullname, path=None, target=None):
+ "Method for Python 3.4+."
+ return PathFinder.find_spec(fullname, path or _get_paths(), target)
+
def hook(path):
if path == nvim.VIM_SPECIAL_PATH:
return VimPathFinder