@@ -41,25 +41,28 @@ def pyls_lint(workspace, document):
41
41
log .debug ("using flake8 with config: %s" , opts ['config' ])
42
42
43
43
# Call the flake8 utility then parse diagnostics from stdout
44
+ flake8_executable = settings .get ('executable' , 'flake8' )
45
+
44
46
args = build_args (opts , document .path )
45
- output = run_flake8 (args )
47
+ output = run_flake8 (flake8_executable , args )
46
48
return parse_stdout (document , output )
47
49
48
50
49
- def run_flake8 (args ):
51
+ def run_flake8 (flake8_executable , args ):
50
52
"""Run flake8 with the provided arguments, logs errors
51
53
from stderr if any.
52
54
"""
53
55
# a quick temporary fix to deal with Atom
54
56
args = [(i if not i .startswith ('--ignore=' ) else FIX_IGNORES_RE .sub ('' , i ))
55
57
for i in args if i is not None ]
56
- log .debug ("Calling flake8 with args: '%s'" , args )
58
+
59
+ log .debug ("Calling %s with args: '%s'" , flake8_executable , args )
57
60
try :
58
- cmd = ['flake8' ]
61
+ cmd = [flake8_executable ]
59
62
cmd .extend (args )
60
63
p = Popen (cmd , stdout = PIPE , stderr = PIPE )
61
64
except IOError :
62
- log .debug ("Can't execute flake8 . Trying with 'python -m flake8'" )
65
+ log .debug ("Can't execute %s . Trying with 'python -m flake8'" , flake8_executable )
63
66
cmd = ['python' , '-m' , 'flake8' ]
64
67
cmd .extend (args )
65
68
p = Popen (cmd , stdout = PIPE , stderr = PIPE )
0 commit comments