aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-10-29 21:44:21 +0100
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-31 07:44:10 -0300
commitf10779fb7a7ee8990a7db723e71d5081a7cb9b6b (patch)
tree8a7837c64d4e54d82de47a52a7845ff0904dcab8
parent3fb5cdcb3f82cbcd345620a853602cf740b48d49 (diff)
downloadrneovim-f10779fb7a7ee8990a7db723e71d5081a7cb9b6b.tar.gz
rneovim-f10779fb7a7ee8990a7db723e71d5081a7cb9b6b.tar.bz2
rneovim-f10779fb7a7ee8990a7db723e71d5081a7cb9b6b.zip
Fix python setup: Make sure python version on user's path is picked.
Problem: executable() was detecting python on user's path, but system() was executing system-level python. Solution: Make sure python version on user's path is executed. Use exepath() to force system() to do so.
-rw-r--r--runtime/plugin/python_setup.vim12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/plugin/python_setup.vim b/runtime/plugin/python_setup.vim
index 5cb2bb260f..0070885958 100644
--- a/runtime/plugin/python_setup.vim
+++ b/runtime/plugin/python_setup.vim
@@ -36,21 +36,25 @@ else
finish
endif
+" Make sure we pick correct python version on path.
+let s:python_interpreter_path = exepath(s:python_interpreter)
+let s:python_version = systemlist(s:python_interpreter_path . ' --version')[0]
+
" Execute python, import neovim and print a string. If import_result matches
" the printed string, we can probably start the host
-let s:import_result = system(s:python_interpreter .
+let s:import_result = system(s:python_interpreter_path .
\ ' -c "import neovim, sys; sys.stdout.write(\"ok\")"')
if s:import_result != 'ok'
- call s:ShowError('No neovim module found')
+ call s:ShowError('No neovim module found for ' . s:python_version)
finish
endif
-let s:pyhost_id = rpcstart(s:python_interpreter,
+let s:pyhost_id = rpcstart(s:python_interpreter_path,
\ ['-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 rpcrequest(s:pyhost_id, 'python_eval', '"o"+"k"') != 'ok' || !has('python')
- call s:ShowError('Something went wrong')
+ call s:ShowError('Something went wrong setting up ' . s:python_version)
call rpcstop(s:pyhost_id)
endif