mirror of
https://github.com/neovim/neovim.git
synced 2026-03-21 16:09:42 +00:00
health.vim: fix $VIRTUAL_ENV validation
Check that the full path to the python interpreter starts with $VIRTUAL_ENV. closes #7770
This commit is contained in:
@@ -370,21 +370,9 @@ function! s:check_python(version) abort
|
||||
let python_bin = ''
|
||||
endif
|
||||
|
||||
|
||||
" Check if $VIRTUAL_ENV is active.
|
||||
" Check if $VIRTUAL_ENV is valid.
|
||||
if exists('$VIRTUAL_ENV')
|
||||
let virtualenv_inactive = 0
|
||||
|
||||
if !empty(pyenv)
|
||||
let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix'])))
|
||||
if $VIRTUAL_ENV != pyenv_prefix
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
|
||||
if virtualenv_inactive
|
||||
if !empty(pyname) && $VIRTUAL_ENV !=# matchstr(exepath(pyname), '^\V'.$VIRTUAL_ENV)
|
||||
call health#report_warn(
|
||||
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
||||
\ . 'This could lead to unexpected results.',
|
||||
|
||||
Reference in New Issue
Block a user