diff --git a/pyflakes.vim b/pyflakes.vim index 88ca43a..4739c2f 100644 --- a/pyflakes.vim +++ b/pyflakes.vim @@ -22,11 +22,21 @@ if !exists('g:pyflakes_builtins') endif if !exists("b:did_python_init") + let b:did_python_init = 0 + + if !has('python') + echoerr "Error: the pyflakes.vim plugin requires Vim to be compiled with +python" + finish + endif + python << EOF import vim import os.path import sys +if sys.version_info[:2] < (2, 5): + raise AssertionError('Vim must be compiled with Python 2.5 or higher; you have ' + sys.version) + # get the directory this script is in: the pyflakes python module should be installed there. scriptdir = os.path.join(os.path.dirname(vim.eval('expand("")')), 'pyflakes') sys.path.insert(0, scriptdir) @@ -86,6 +96,10 @@ EOF let b:did_python_init = 1 endif +if !b:did_python_init + finish +endif + au BufLeave call s:ClearPyflakes() au BufEnter call s:RunPyflakes()