Fix #177 - Check Python version >= 2.7
This commit is contained in:
parent
8a525f165c
commit
bb48508c3e
26
plug.vim
26
plug.vim
|
@ -236,18 +236,22 @@ function! s:trim(str)
|
||||||
return substitute(a:str, '[\/]\+$', '', '')
|
return substitute(a:str, '[\/]\+$', '', '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:git_version_requirement(...)
|
function! s:version_requirement(val, min)
|
||||||
let s:git_version = get(s:, 'git_version',
|
for idx in range(0, len(a:min) - 1)
|
||||||
\ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)'))
|
let v = get(a:val, idx, 0)
|
||||||
for idx in range(0, a:0 - 1)
|
if v < a:min[idx] | return 0
|
||||||
let v = get(s:git_version, idx, 0)
|
elseif v > a:min[idx] | return 1
|
||||||
if v < a:000[idx] | return 0
|
|
||||||
elseif v > a:000[idx] | return 1
|
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:git_version_requirement(...)
|
||||||
|
let s:git_version = get(s:, 'git_version',
|
||||||
|
\ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)'))
|
||||||
|
return s:version_requirement(s:git_version, a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:progress_opt(base)
|
function! s:progress_opt(base)
|
||||||
return a:base && !s:is_win &&
|
return a:base && !s:is_win &&
|
||||||
\ s:git_version_requirement(1, 7, 1) ? '--progress' : ''
|
\ s:git_version_requirement(1, 7, 1) ? '--progress' : ''
|
||||||
|
@ -755,6 +759,14 @@ function! s:update_impl(pull, force, args) abort
|
||||||
call append(0, ['', ''])
|
call append(0, ['', ''])
|
||||||
normal! 2G
|
normal! 2G
|
||||||
|
|
||||||
|
" Python version requirement (>= 2.7)
|
||||||
|
if s:py2 && !s:ruby && !s:nvim && s:update.threads > 1
|
||||||
|
redir => pyv
|
||||||
|
silent python import platform; print(platform.python_version())
|
||||||
|
redir END
|
||||||
|
let s:py2 = s:version_requirement(
|
||||||
|
\ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 7])
|
||||||
|
endif
|
||||||
if (s:py2 || s:ruby) && !s:nvim && s:update.threads > 1
|
if (s:py2 || s:ruby) && !s:nvim && s:update.threads > 1
|
||||||
try
|
try
|
||||||
let imd = &imd
|
let imd = &imd
|
||||||
|
|
Loading…
Reference in New Issue
Block a user