[Python-modules-commits] [python-neovim] 01/05: Import python-neovim_0.1.10.orig.tar.gz

Víctor Cuadrado Juan viccuad-guest at moszumanska.debian.org
Fri Oct 28 21:50:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

viccuad-guest pushed a commit to branch master
in repository python-neovim.

commit c06e8467db7d51bd5d44f0d68be446f2c20dd299
Author: Víctor Cuadrado Juan <me at viccuad.me>
Date:   Fri Oct 28 21:08:12 2016 +0200

    Import python-neovim_0.1.10.orig.tar.gz
---
 PKG-INFO                                 |  4 ++--
 README.md                                |  4 +++-
 neovim.egg-info/PKG-INFO                 |  4 ++--
 neovim/__init__.py                       | 16 ++++++++++++----
 neovim/api/buffer.py                     |  4 ++--
 neovim/api/nvim.py                       | 27 +++++++++++++++++++++------
 neovim/msgpack_rpc/event_loop/asyncio.py |  2 +-
 neovim/plugin/host.py                    |  1 -
 setup.py                                 |  4 ++--
 test/test_buffer.py                      |  2 ++
 test/test_common.py                      |  2 +-
 11 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 6703385..ebbee31 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: neovim
-Version: 0.1.9
+Version: 0.1.10
 Summary: Python client to neovim
 Home-page: http://github.com/neovim/python-client
 Author: Thiago de Arruda
 Author-email: tpadilha84 at gmail.com
 License: Apache
-Download-URL: https://github.com/neovim/python-client/archive/0.1.9.tar.gz
+Download-URL: https://github.com/neovim/python-client/archive/0.1.10.tar.gz
 Description: UNKNOWN
 Platform: UNKNOWN
diff --git a/README.md b/README.md
index fbae2a9..97f9dbc 100644
--- a/README.md
+++ b/README.md
@@ -145,7 +145,9 @@ You can run the plugin host in nvim with logging enabled to debug errors:
 NVIM_PYTHON_LOG_FILE=logfile NVIM_PYTHON_LOG_LEVEL=DEBUG nvim
 ```
 As more than one python host process might be started, the log filenames take
-the pattern `logfile_PID` where `PID` is the process id.
+the pattern `logfile_pyX_KIND` where `X` is the major python version (2 or 3)
+and `KIND` is either "rplugin" or "script" (for the `:python[3]`
+script interface).
 
 If the host cannot start at all, the error could be found in `~/.nvimlog` if
 `nvim` was compiled with logging.
diff --git a/neovim.egg-info/PKG-INFO b/neovim.egg-info/PKG-INFO
index 6703385..ebbee31 100644
--- a/neovim.egg-info/PKG-INFO
+++ b/neovim.egg-info/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: neovim
-Version: 0.1.9
+Version: 0.1.10
 Summary: Python client to neovim
 Home-page: http://github.com/neovim/python-client
 Author: Thiago de Arruda
 Author-email: tpadilha84 at gmail.com
 License: Apache
-Download-URL: https://github.com/neovim/python-client/archive/0.1.9.tar.gz
+Download-URL: https://github.com/neovim/python-client/archive/0.1.10.tar.gz
 Description: UNKNOWN
 Platform: UNKNOWN
diff --git a/neovim/__init__.py b/neovim/__init__.py
index 8d12a07..d84b968 100644
--- a/neovim/__init__.py
+++ b/neovim/__init__.py
@@ -53,7 +53,14 @@ def start_host(session=None):
         if os.path.isdir(path) and dup in plugins:
             plugins.remove(dup)
 
-    setup_logging()
+    # Special case: the legacy scripthost receives a single relative filename
+    # while the rplugin host will receive absolute paths.
+    if plugins == ["script_host.py"]:
+        name = "script"
+    else:
+        name = "rplugin"
+
+    setup_logging(name)
 
     if not session:
         session = stdio_session()
@@ -94,12 +101,13 @@ def attach(session_type, address=None, port=None,
     return Nvim.from_session(session).with_decode(decode)
 
 
-def setup_logging():
+def setup_logging(name):
     """Setup logging according to environment variables."""
     logger = logging.getLogger(__name__)
     if 'NVIM_PYTHON_LOG_FILE' in os.environ:
-        logfile = (os.environ['NVIM_PYTHON_LOG_FILE'].strip() +
-                   '_' + str(os.getpid()))
+        prefix = os.environ['NVIM_PYTHON_LOG_FILE'].strip()
+        major_version = sys.version_info[0]
+        logfile = '{0}_py{1}_{2}'.format(prefix, major_version, name)
         handler = logging.FileHandler(logfile, 'w')
         handler.formatter = logging.Formatter(
             '%(asctime)s [%(levelname)s @ '
diff --git a/neovim/api/buffer.py b/neovim/api/buffer.py
index d2b2f43..29de15b 100644
--- a/neovim/api/buffer.py
+++ b/neovim/api/buffer.py
@@ -104,7 +104,7 @@ class Buffer(Remote):
 
     def append(self, lines, index=-1):
         """Append a string or list of lines to the buffer."""
-        if isinstance(lines, basestring):
+        if isinstance(lines, (basestring, bytes)):
             lines = [lines]
         return self._session.request('buffer_insert', self, index, lines)
 
@@ -125,7 +125,7 @@ class Buffer(Remote):
                             line, col_start, col_end, async=async)
 
     def clear_highlight(self, src_id, line_start=0, line_end=-1, async=True):
-        """clear highlights from the buffer."""
+        """Clear highlights from the buffer."""
         self.request('buffer_clear_highlight', src_id,
                      line_start, line_end, async=async)
 
diff --git a/neovim/api/nvim.py b/neovim/api/nvim.py
index 8a1641b..e34c48d 100644
--- a/neovim/api/nvim.py
+++ b/neovim/api/nvim.py
@@ -146,17 +146,32 @@ class Nvim(object):
         This should not be called from a plugin running in the host, which
         already runs the loop and dispatches events to plugins.
         """
+        if err_cb is None:
+            err_cb = sys.stderr.write
+        self._err_cb = err_cb
+
         def filter_request_cb(name, args):
+            name = self._from_nvim(name)
             args = walk(self._from_nvim, args)
-            result = request_cb(self._from_nvim(name), args)
+            try:
+                result = request_cb(name, args)
+            except Exception:
+                msg = ("error caught in request handler '{} {}'\n{}\n\n"
+                       .format(name, args, format_exc_skip(1, 5)))
+                self._err_cb(msg)
+                raise
             return walk(self._to_nvim, result)
 
         def filter_notification_cb(name, args):
-            notification_cb(self._from_nvim(name), walk(self._from_nvim, args))
-
-        if err_cb is None:
-            err_cb = sys.stderr.write
-        self._err_cb = err_cb
+            name = self._from_nvim(name)
+            args = walk(self._from_nvim, args)
+            try:
+                notification_cb(name, args)
+            except Exception:
+                msg = ("error caught in notification handler '{} {}'\n{}\n\n"
+                       .format(name, args, format_exc_skip(1, 5)))
+                self._err_cb(msg)
+                raise
 
         self._session.run(filter_request_cb, filter_notification_cb, setup_cb)
 
diff --git a/neovim/msgpack_rpc/event_loop/asyncio.py b/neovim/msgpack_rpc/event_loop/asyncio.py
index 87ce79a..1b28135 100644
--- a/neovim/msgpack_rpc/event_loop/asyncio.py
+++ b/neovim/msgpack_rpc/event_loop/asyncio.py
@@ -59,7 +59,7 @@ class AsyncioEventLoop(BaseEventLoop, asyncio.Protocol,
 
     def pipe_data_received(self, fd, data):
         """Used to signal `asyncio.SubprocessProtocol` of incoming data."""
-        if fd == sys.stderr.fileno():
+        if fd == 2:  # stderr fd number
             self._on_stderr(data)
         elif self._on_data:
             self._on_data(data)
diff --git a/neovim/plugin/host.py b/neovim/plugin/host.py
index f1ee98e..6769ef6 100644
--- a/neovim/plugin/host.py
+++ b/neovim/plugin/host.py
@@ -77,7 +77,6 @@ class Host(object):
                 msg = ("error caught in async handler '{} {}'\n{}\n"
                        .format(name, args, format_exc_skip(1, 5)))
                 self._on_async_err(msg + "\n")
-                raise
 
     def _on_request(self, name, args):
         """Handle a msgpack-rpc request."""
diff --git a/setup.py b/setup.py
index dccda98..fab84e3 100644
--- a/setup.py
+++ b/setup.py
@@ -19,10 +19,10 @@ if platform.python_implementation() != 'PyPy':
     install_requires.append('greenlet')
 
 setup(name='neovim',
-      version='0.1.9',
+      version='0.1.10',
       description='Python client to neovim',
       url='http://github.com/neovim/python-client',
-      download_url='https://github.com/neovim/python-client/archive/0.1.9.tar.gz',
+      download_url='https://github.com/neovim/python-client/archive/0.1.10.tar.gz',
       author='Thiago de Arruda',
       author_email='tpadilha84 at gmail.com',
       license='Apache',
diff --git a/test/test_buffer.py b/test/test_buffer.py
index cb863cc..a99a9ce 100644
--- a/test/test_buffer.py
+++ b/test/test_buffer.py
@@ -140,6 +140,8 @@ def test_append():
     eq(vim.current.buffer[:], ['b', '', 'a', 'c', 'd'])
     vim.current.buffer.append(['c', 'd'], 2)
     eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd'])
+    vim.current.buffer.append(b'bytes')
+    eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd', 'bytes'])
 
 
 @with_setup(setup=cleanup)
diff --git a/test/test_common.py b/test/test_common.py
index 540d9f3..c17823f 100644
--- a/test/test_common.py
+++ b/test/test_common.py
@@ -6,7 +6,7 @@ import neovim
 
 from nose.tools import eq_ as eq
 
-neovim.setup_logging()
+neovim.setup_logging("test")
 
 child_argv = os.environ.get('NVIM_CHILD_ARGV')
 listen_address = os.environ.get('NVIM_LISTEN_ADDRESS')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-neovim.git



More information about the Python-modules-commits mailing list