@@ -41,25 +41,28 @@ def pyls_lint(workspace, document):
4141 log .debug ("using flake8 with config: %s" , opts ['config' ])
4242
4343 # Call the flake8 utility then parse diagnostics from stdout
44+ flake8_executable = settings .get ('executable' , 'flake8' )
45+
4446 args = build_args (opts , document .path )
45- output = run_flake8 (args )
47+ output = run_flake8 (flake8_executable , args )
4648 return parse_stdout (document , output )
4749
4850
49- def run_flake8 (args ):
51+ def run_flake8 (flake8_executable , args ):
5052 """Run flake8 with the provided arguments, logs errors
5153 from stderr if any.
5254 """
5355 # a quick temporary fix to deal with Atom
5456 args = [(i if not i .startswith ('--ignore=' ) else FIX_IGNORES_RE .sub ('' , i ))
5557 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 )
5760 try :
58- cmd = ['flake8' ]
61+ cmd = [flake8_executable ]
5962 cmd .extend (args )
6063 p = Popen (cmd , stdout = PIPE , stderr = PIPE )
6164 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 )
6366 cmd = ['python' , '-m' , 'flake8' ]
6467 cmd .extend (args )
6568 p = Popen (cmd , stdout = PIPE , stderr = PIPE )
0 commit comments