summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/python/flake8.vim12
-rw-r--r--ale_linters/python/mypy.vim2
-rw-r--r--ale_linters/python/pylint.vim14
-rw-r--r--autoload/ale/fixers/autopep8.vim2
-rw-r--r--autoload/ale/fixers/isort.vim2
-rw-r--r--autoload/ale/fixers/yapf.vim2
-rw-r--r--autoload/ale/python.vim6
7 files changed, 11 insertions, 29 deletions
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index fb02e1ee..bf7b3027 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -19,16 +19,8 @@ function! s:UsingModule(buffer) abort
endfunction
function! ale_linters#python#flake8#GetExecutable(buffer) abort
- if !s:UsingModule(a:buffer) && !ale#Var(a:buffer, 'python_flake8_use_global')
- let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
-
- if !empty(l:virtualenv)
- let l:ve_flake8 = l:virtualenv . '/bin/flake8'
-
- if executable(l:ve_flake8)
- return l:ve_flake8
- endif
- endif
+ if !s:UsingModule(a:buffer)
+ return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
endif
return ale#Var(a:buffer, 'python_flake8_executable')
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim
index e39ee349..f71365a6 100644
--- a/ale_linters/python/mypy.vim
+++ b/ale_linters/python/mypy.vim
@@ -7,7 +7,7 @@ let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
let g:ale_python_mypy_use_global = get(g:, 'ale_python_mypy_use_global', 0)
function! ale_linters#python#mypy#GetExecutable(buffer) abort
- return ale#python#FindExecutable(a:buffer, 'python_mypy', ['/bin/mypy'])
+ return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
endfunction
function! ale_linters#python#mypy#GetCommand(buffer) abort
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index dcb26c78..6f95776b 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -10,19 +10,7 @@ let g:ale_python_pylint_options =
let g:ale_python_pylint_use_global = get(g:, 'ale_python_pylint_use_global', 0)
function! ale_linters#python#pylint#GetExecutable(buffer) abort
- if !ale#Var(a:buffer, 'python_pylint_use_global')
- let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
-
- if !empty(l:virtualenv)
- let l:ve_pylint = l:virtualenv . '/bin/pylint'
-
- if executable(l:ve_pylint)
- return l:ve_pylint
- endif
- endif
- endif
-
- return ale#Var(a:buffer, 'python_pylint_executable')
+ return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort
diff --git a/autoload/ale/fixers/autopep8.vim b/autoload/ale/fixers/autopep8.vim
index 908980dc..e2dd7bfe 100644
--- a/autoload/ale/fixers/autopep8.vim
+++ b/autoload/ale/fixers/autopep8.vim
@@ -9,7 +9,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autopep8',
- \ ['/bin/autopep8'],
+ \ ['autopep8'],
\)
if !executable(l:executable)
diff --git a/autoload/ale/fixers/isort.vim b/autoload/ale/fixers/isort.vim
index 067d44dd..00d968f4 100644
--- a/autoload/ale/fixers/isort.vim
+++ b/autoload/ale/fixers/isort.vim
@@ -8,7 +8,7 @@ function! ale#fixers#isort#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_isort',
- \ ['/bin/isort'],
+ \ ['isort'],
\)
if !executable(l:executable)
diff --git a/autoload/ale/fixers/yapf.vim b/autoload/ale/fixers/yapf.vim
index 117a9550..7d6dfdcb 100644
--- a/autoload/ale/fixers/yapf.vim
+++ b/autoload/ale/fixers/yapf.vim
@@ -8,7 +8,7 @@ function! ale#fixers#yapf#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_yapf',
- \ ['/bin/yapf'],
+ \ ['yapf'],
\)
if !executable(l:executable)
diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim
index 4c516abf..95fa58c7 100644
--- a/autoload/ale/python.vim
+++ b/autoload/ale/python.vim
@@ -1,6 +1,8 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Functions for integrating with Python linters.
+" bin is used for Unix virtualenv directories, and Scripts is for Windows.
+let s:bin_dir = has('unix') ? 'bin' : 'Scripts'
let g:ale_virtualenv_dir_names = get(g:, 'ale_virtualenv_dir_names', [
\ '.env',
\ 'env',
@@ -29,7 +31,7 @@ function! ale#python#FindVirtualenv(buffer) abort
for l:dirname in ale#Var(a:buffer, 'virtualenv_dir_names')
let l:venv_dir = simplify(l:path . '/' . l:dirname)
- if filereadable(l:venv_dir . '/bin/activate')
+ if filereadable(simplify(l:venv_dir . '/' . s:bin_dir . '/activate'))
return l:venv_dir
endif
endfor
@@ -50,7 +52,7 @@ function! ale#python#FindExecutable(buffer, base_var_name, path_list) abort
if !empty(l:virtualenv)
for l:path in a:path_list
- let l:ve_executable = l:virtualenv . l:path
+ let l:ve_executable = simplify(l:virtualenv . '/' . s:bin_dir . '/' . l:path)
if executable(l:ve_executable)
return l:ve_executable