checkhealth: Python: fix VIRTUAL_ENV check (#8628)

Compare `$VIRTUAL_ENV` to `python_bin`.
This is necessary when `g:python_host_prog` is set to an absolute path,
and looking up `pyname` in `$PATH` yields another result.
This commit is contained in:
Daniel Hahler 2018-06-24 10:28:21 +02:00 committed by Justin M. Keyes
parent ddde747644
commit bf6048e81d
1 changed files with 4 additions and 2 deletions

View File

@ -383,8 +383,10 @@ function! s:check_python(version) abort
endif
" Check if $VIRTUAL_ENV is valid.
if exists('$VIRTUAL_ENV')
if !empty(pyname) && $VIRTUAL_ENV !=# matchstr(exepath(pyname), '^\V'.$VIRTUAL_ENV)
if exists('$VIRTUAL_ENV') && !empty(python_bin)
if $VIRTUAL_ENV ==# matchstr(python_bin, '^\V'.$VIRTUAL_ENV)
call health#report_info('$VIRTUAL_ENV matches executable')
else
call health#report_warn(
\ '$VIRTUAL_ENV exists but appears to be inactive. '
\ . 'This could lead to unexpected results.',