detect python binary from common paths
This commit is contained in:
parent
dfa06d11fe
commit
a70243be77
1 changed files with 24 additions and 3 deletions
|
@ -295,11 +295,32 @@ let s:VERSION = '7.0.7'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let python_bin = g:wakatime_PythonBinary
|
let python_bin = g:wakatime_PythonBinary
|
||||||
|
if !filereadable(python_bin)
|
||||||
|
let paths = ['python3']
|
||||||
if s:IsWindows()
|
if s:IsWindows()
|
||||||
if python_bin == 'python'
|
let pyver = 50
|
||||||
let python_bin = 'pythonw'
|
while pyver >= 26
|
||||||
|
let paths = paths + [printf('/Python%d/pythonw', pyver), printf('/python%d/pythonw', pyver), printf('/Python%d/python', pyver), printf('/python%d/python', pyver)]
|
||||||
|
let pyver = pyver - 1
|
||||||
|
endwhile
|
||||||
|
else
|
||||||
|
let paths = paths + ['/usr/bin/python3', '/usr/local/bin/python3', '/usr/bin/python3.6', '/usr/local/bin/python3.6', '/usr/bin/python', '/usr/local/bin/python', '/usr/bin/python2', '/usr/local/bin/python2']
|
||||||
endif
|
endif
|
||||||
|
let paths = paths + ['python']
|
||||||
|
let index = 0
|
||||||
|
let limit = len(paths)
|
||||||
|
while index < limit
|
||||||
|
if filereadable(paths[index])
|
||||||
|
let python_bin = paths[index]
|
||||||
|
let index = limit
|
||||||
endif
|
endif
|
||||||
|
let index = index + 1
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
if s:IsWindows() && filereadable(printf('%sw', python_bin))
|
||||||
|
let python_bin = printf('%sw', python_bin)
|
||||||
|
endif
|
||||||
|
|
||||||
let cmd = [python_bin, '-W', 'ignore', s:cli_location]
|
let cmd = [python_bin, '-W', 'ignore', s:cli_location]
|
||||||
let cmd = cmd + ['--entity', heartbeat.entity]
|
let cmd = cmd + ['--entity', heartbeat.entity]
|
||||||
let cmd = cmd + ['--time', heartbeat.time]
|
let cmd = cmd + ['--time', heartbeat.time]
|
||||||
|
|
Loading…
Reference in a new issue