Auto merge of #3303 - micbou:python-check, r=micbou
[READY] Improve error message when unable to load Python The current error when Python cannot be loaded > YouCompleteMe unavailable: requires Vim compiled Python (2.7.1+ or 3.4+) support. is misleading if Vim has been dynamically compiled against Python but is unable to find the library. See issue https://github.com/Valloric/YouCompleteMe/issues/3300 for instance. We should only return that error if `has( 'python_compiled' )` and `has( 'python3_compiled' )` are both false. Furthermore, we should check if Python 3 is available before Python 2 because on some platforms, only one Python library can be loaded at a time so if Python 2 is loaded first, Python 3 cannot be used. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/3303) <!-- Reviewable:end -->
This commit is contained in:
commit
b26ba2681e
@ -54,13 +54,22 @@ elseif !has( 'timers' )
|
|||||||
\ echohl None
|
\ echohl None
|
||||||
call s:restore_cpo()
|
call s:restore_cpo()
|
||||||
finish
|
finish
|
||||||
elseif !has( 'python' ) && !has( 'python3' )
|
elseif !has( 'python_compiled' ) && !has( 'python3_compiled' )
|
||||||
echohl WarningMsg |
|
echohl WarningMsg |
|
||||||
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
|
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
|
||||||
\ "Python (2.7.1+ or 3.4+) support." |
|
\ "Python (2.7.1+ or 3.4+) support." |
|
||||||
\ echohl None
|
\ echohl None
|
||||||
call s:restore_cpo()
|
call s:restore_cpo()
|
||||||
finish
|
finish
|
||||||
|
" These calls try to load the Python 2 and Python 3 libraries when Vim is
|
||||||
|
" compiled dynamically against them. Since only one can be loaded at a time on
|
||||||
|
" some platforms, we first check if Python 3 is available.
|
||||||
|
elseif !has( 'python3' ) && !has( 'python' )
|
||||||
|
echohl WarningMsg |
|
||||||
|
\ echomsg "YouCompleteMe unavailable: unable to load Python." |
|
||||||
|
\ echohl None
|
||||||
|
call s:restore_cpo()
|
||||||
|
finish
|
||||||
elseif &encoding !~? 'utf-\?8'
|
elseif &encoding !~? 'utf-\?8'
|
||||||
echohl WarningMsg |
|
echohl WarningMsg |
|
||||||
\ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " .
|
\ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " .
|
||||||
|
Loading…
Reference in New Issue
Block a user