python3-neovim: update to 0.5.0.
This commit is contained in:
parent
901cd3857a
commit
8545d8ede4
|
@ -1,105 +0,0 @@
|
|||
backport of:
|
||||
https://github.com/neovim/pynvim/commit/eaa862dec340cad523a691d6441e890b800f8b65
|
||||
https://github.com/neovim/pynvim/commit/919217d9211adabd7fd57085657096a5060aece4
|
||||
https://github.com/neovim/pynvim/commit/dd540b08e1a13c89557aa91a122ca6fbc9dfe2ef
|
||||
|
||||
--- a/pynvim/compat.py
|
||||
+++ b/pynvim/compat.py
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
-from imp import find_module as original_find_module
|
||||
|
||||
|
||||
IS_PYTHON3 = sys.version_info >= (3, 0)
|
||||
@@ -27,6 +26,8 @@
|
||||
else:
|
||||
newpath.append(element)
|
||||
path = newpath
|
||||
+
|
||||
+ from imp import find_module as original_find_module
|
||||
return original_find_module(fullname, path)
|
||||
|
||||
# There is no 'long' type in Python3 just int
|
||||
--- a/pynvim/plugin/script_host.py
|
||||
+++ b/pynvim/plugin/script_host.py
|
||||
@@ -1,5 +1,4 @@
|
||||
"""Legacy python/python3-vim emulation."""
|
||||
-import imp
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
@@ -214,6 +213,7 @@
|
||||
return discover_runtime_directories(nvim)
|
||||
|
||||
def _find_module(fullname, oldtail, path):
|
||||
+ import imp
|
||||
idx = oldtail.find('.')
|
||||
if idx > 0:
|
||||
name = oldtail[:idx]
|
||||
@@ -234,6 +234,7 @@
|
||||
return sys.modules[fullname]
|
||||
except KeyError:
|
||||
pass
|
||||
+ import imp
|
||||
return imp.load_module(fullname, *self.module)
|
||||
|
||||
class VimPathFinder(object):
|
||||
--- a/pynvim/plugin/host.py
|
||||
+++ b/pynvim/plugin/host.py
|
||||
@@ -1,5 +1,4 @@
|
||||
"""Implements a Nvim host for python plugins."""
|
||||
-import imp
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
@@ -9,7 +8,7 @@
|
||||
from traceback import format_exc
|
||||
|
||||
from pynvim.api import decode_if_bytes, walk
|
||||
-from pynvim.compat import IS_PYTHON3, find_module
|
||||
+from pynvim.compat import IS_PYTHON3
|
||||
from pynvim.msgpack_rpc import ErrorResponse
|
||||
from pynvim.plugin import script_host
|
||||
from pynvim.util import format_exc_skip, get_client_info
|
||||
@@ -23,6 +22,26 @@
|
||||
host_method_spec = {"poll": {}, "specs": {"nargs": 1}, "shutdown": {}}
|
||||
|
||||
|
||||
+def handle_import(directory, name):
|
||||
+ """Import a python file given a known location.
|
||||
+ Currently works on both python2 or 3.
|
||||
+ """
|
||||
+ try: # Python3
|
||||
+ from importlib.util import module_from_spec, spec_from_file_location
|
||||
+ except ImportError: # Python2.7
|
||||
+ import imp
|
||||
+ from pynvim.compat import find_module
|
||||
+ file, pathname, descr = find_module(name, [directory])
|
||||
+ module = imp.load_module(name, file, pathname, descr)
|
||||
+ return module
|
||||
+ else:
|
||||
+ spec = spec_from_file_location(name, location=directory)
|
||||
+ if spec is not None:
|
||||
+ return module_from_spec(spec)
|
||||
+ else:
|
||||
+ raise ImportError
|
||||
+
|
||||
+
|
||||
class Host(object):
|
||||
|
||||
"""Nvim host for python plugins.
|
||||
@@ -161,8 +180,10 @@
|
||||
has_script = True
|
||||
else:
|
||||
directory, name = os.path.split(os.path.splitext(path)[0])
|
||||
- file, pathname, descr = find_module(name, [directory])
|
||||
- module = imp.load_module(name, file, pathname, descr)
|
||||
+ try:
|
||||
+ module = handle_import(directory, name)
|
||||
+ except ImportError:
|
||||
+ return
|
||||
handlers = []
|
||||
self._discover_classes(module, handlers, path)
|
||||
self._discover_functions(module, handlers, path, False)
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'python3-neovim'
|
||||
pkgname=python3-neovim
|
||||
version=0.4.3
|
||||
revision=5
|
||||
version=0.5.0
|
||||
revision=1
|
||||
build_style="python3-module"
|
||||
hostmakedepends="python3-setuptools"
|
||||
depends="neovim python3-greenlet python3-msgpack"
|
||||
|
@ -10,4 +10,4 @@ maintainer="Orphaned <orphan@voidlinux.org>"
|
|||
license="Apache-2.0"
|
||||
homepage="https://github.com/neovim/pynvim"
|
||||
distfiles="https://github.com/neovim/pynvim/archive/${version}.tar.gz"
|
||||
checksum=e7c9de44b0201ad874a608270b7a9b10fd48bda65f49bada05815d973ca79391
|
||||
checksum=448414e8d005b6d99868c8badeec7a20b10a7a37fb6b85fb12846b80c044c279
|
||||
|
|
Loading…
Reference in New Issue