diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-13 18:52:46 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-13 21:35:47 -0300 |
commit | c66959d115a205050443e1bb24732783b91d210f (patch) | |
tree | 2d210025a065648f1269e85bd7ff5fb5e6c672e6 | |
parent | 746e7cce219fd711adb80f9e1aa38c892a9ac62e (diff) | |
download | rneovim-c66959d115a205050443e1bb24732783b91d210f.tar.gz rneovim-c66959d115a205050443e1bb24732783b91d210f.tar.bz2 rneovim-c66959d115a205050443e1bb24732783b91d210f.zip |
runtime: Update python_setup.vim to the new rpc function names
Also improve version checking.
-rw-r--r-- | runtime/plugin/python_setup.vim | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/runtime/plugin/python_setup.vim b/runtime/plugin/python_setup.vim index 7b2d800f74..1f0f07b7fa 100644 --- a/runtime/plugin/python_setup.vim +++ b/runtime/plugin/python_setup.vim @@ -6,18 +6,21 @@ let did_python_setup = 1 let s:get_version = - \ ' -c "import sys; sys.stdout.write(str(sys.version_info.major))"' + \ ' -c "import sys; sys.stdout.write(str(sys.version_info.major) + '. + \ '\".\" + str(sys.version_info.minor))"' + +let s:supported = ['2.6', '2.7'] " To load the python host a python 2 executable must be available if exists('python_interpreter') \ && executable(g:python_interpreter) - \ && system(g:python_interpreter.s:get_version) == "2" + \ && index(s:supported, system(g:python_interpreter.s:get_version)) >= 0 let s:python_interpreter = g:python_interpreter -elseif executable('python') && - \ system('python'.s:get_version) == "2" +elseif executable('python') + \ && index(s:supported, system('python'.s:get_version)) >= 0 let s:python_interpreter = 'python' -elseif executable('python2') && - \ system('python2'.s:get_version) == "2" +elseif executable('python2') + \ && index(s:supported, system('python2'.s:get_version)) >= 0 " In some distros, python3 is the default python let s:python_interpreter = 'python2' else @@ -33,12 +36,12 @@ if s:import_result != 'ok' finish endif -let s:pyhost_id = api_spawn(s:python_interpreter, +let s:pyhost_id = rpcstart(s:python_interpreter, \ ['-c', 'import neovim; neovim.start_host()']) " Evaluate an expression in the script host as an additional sanity check, and " to block until all providers have been registered(or else some plugins loaded " by the user's vimrc would not get has('python') == 1 -if send_call(s:pyhost_id, 'python_eval', '"o" + "k"') != 'ok' || !has('python') +if rpcrequest(s:pyhost_id, 'python_eval', '"o"+"k"') != 'ok' || !has('python') " Something went wrong - api_close(s:pyhost_id) + rpcstop(s:pyhost_id) endif |