diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-06-23 08:32:49 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-06-23 08:32:49 +0900 |
commit | e40029e3281d314ee95c10b6adbd7a4cc91afae1 (patch) | |
tree | 942a066224456ad9b535e693fba4c9845dbfa272 /rplugin/python3/deoplete | |
parent | d8cdd7009d36c9e0c8159b88b8035055c6f7f1e8 (diff) | |
download | deoplete.nvim-e40029e3281d314ee95c10b6adbd7a4cc91afae1.zip |
Implement version check
Diffstat (limited to 'rplugin/python3/deoplete')
-rw-r--r-- | rplugin/python3/deoplete/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rplugin/python3/deoplete/__init__.py b/rplugin/python3/deoplete/__init__.py index 9521c7a..bcfcf2d 100644 --- a/rplugin/python3/deoplete/__init__.py +++ b/rplugin/python3/deoplete/__init__.py @@ -5,9 +5,12 @@ # ============================================================================ import neovim +import os +import re from deoplete import logger from deoplete.deoplete import Deoplete +from glob import glob @neovim.plugin @@ -21,6 +24,18 @@ class DeopleteHandlers(object): self.__deoplete = Deoplete(self.__vim) self.__vim.vars['deoplete#_channel_id'] = self.__vim.channel_id + # Check neovim-python version. + version = 'unknown' + python_dir = os.path.dirname(os.path.dirname(neovim.__file__)) + base = python_dir + '/neovim-*/' + for metadata in glob(base + 'PKG-INFO') + glob(base + '/METADATA'): + with open(metadata, 'r', errors='replace') as f: + for line in f: + m = re.match('Version: (.+)', line) + if m: + version = m.group(1) + self.__vim.vars['deoplete#_neovim_python_version'] = version + @neovim.rpc_export('deoplete_enable_logging', sync=True) def enable_logging(self, level, logfile): logger.setup(self.__vim, level, logfile) |