Starting ycmd with Python used to build it
Note: depends on Valloric/ycmd#466 being merged and the ycmd submodule ref then being updated. Fixes #2136
This commit is contained in:
parent
7f419101fe
commit
8fe90b43c4
@ -63,6 +63,10 @@ def PathToPythonInterpreter():
|
||||
raise RuntimeError( "Path in 'g:ycm_server_python_interpreter' option "
|
||||
"does not point to a valid Python 2.6+ or 3.3+." )
|
||||
|
||||
python_interpreter = _PathToPythonUsedDuringBuild()
|
||||
if IsPythonVersionCorrect( python_interpreter ):
|
||||
return python_interpreter
|
||||
|
||||
# On UNIX platforms, we use sys.executable as the Python interpreter path.
|
||||
# We cannot use sys.executable on Windows because for unknown reasons, it
|
||||
# returns the Vim executable. Instead, we use sys.exec_prefix to deduce the
|
||||
@ -90,9 +94,20 @@ def PathToPythonInterpreter():
|
||||
"option." )
|
||||
|
||||
|
||||
def _PathToPythonUsedDuringBuild():
|
||||
from ycmd import utils
|
||||
|
||||
try:
|
||||
filepath = os.path.join( DIR_OF_YCMD, 'PYTHON_USED_DURING_BUILDING' )
|
||||
return utils.ReadFile( filepath ).strip()
|
||||
# We need to check for IOError for Python2 and OSError for Python3
|
||||
except ( IOError, OSError ):
|
||||
return None
|
||||
|
||||
|
||||
def EndsWithPython( path ):
|
||||
"""Check if given path ends with a python 2.6+ or 3.3+ name."""
|
||||
return PYTHON_BINARY_REGEX.search( path ) is not None
|
||||
return path and PYTHON_BINARY_REGEX.search( path ) is not None
|
||||
|
||||
|
||||
def IsPythonVersionCorrect( path ):
|
||||
|
@ -66,6 +66,8 @@ def EndsWithPython_Python3Paths_test():
|
||||
|
||||
def EndsWithPython_BadPaths_test():
|
||||
not_python_paths = [
|
||||
None,
|
||||
'',
|
||||
'/opt/local/bin/vim',
|
||||
r'C:\Program Files\Vim\vim74\gvim.exe',
|
||||
'/usr/bin/python2.5',
|
||||
|
2
third_party/ycmd
vendored
2
third_party/ycmd
vendored
@ -1 +1 @@
|
||||
Subproject commit 09f216441f99c02d51f9460e006683c5fe83669e
|
||||
Subproject commit 89e558f7d49b6d9672477c0d1b4df41d33f1c2e7
|
Loading…
Reference in New Issue
Block a user