Use g:pymode_python-defined interpreter if defined and exists, otherwise use existing defaults (#666)

This is helpful when using custom-compiled interpreters, or alternative
Python interpreters in non-standard locations
This commit is contained in:
pmacosta 2019-05-07 13:28:56 -04:00 committed by Łukasz Langa
parent 14cbf737df
commit 4931ddd0b1

View File

@ -37,10 +37,17 @@ if !exists("g:black_skip_string_normalization")
endif
python3 << endpython3
import os
import sys
import vim
def _get_python_binary(exec_prefix):
try:
default = vim.eval("g:pymode_python").strip()
except vim.error:
default = ""
if default and os.path.exists(default):
return default
if sys.platform[:3] == "win":
return exec_prefix / 'python.exe'
return exec_prefix / 'bin' / 'python3'