Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Show a clear error message if vim was compiled without Python, or wit…
Browse files Browse the repository at this point in the history
…h a version of Python older than 2.5.
  • Loading branch information
kevinw committed Apr 1, 2010
1 parent 783b3aa commit 5eaf3bc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pyflakes.vim
Expand Up @@ -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("<sfile>")')), 'pyflakes')
sys.path.insert(0, scriptdir)
Expand Down Expand Up @@ -86,6 +96,10 @@ EOF
let b:did_python_init = 1
endif

if !b:did_python_init
finish
endif

au BufLeave <buffer> call s:ClearPyflakes()

au BufEnter <buffer> call s:RunPyflakes()
Expand Down

0 comments on commit 5eaf3bc

Please sign in to comment.