def PathToPythonInterpreter(): # Not calling the Python interpreter to check its version as it significantly # impacts startup time. from ycmd import utils python_interpreter = vim.eval('g:ycm_server_python_interpreter') if python_interpreter: python_interpreter = utils.FindExecutable(python_interpreter) if python_interpreter: return python_interpreter raise RuntimeError("Path in 'g:ycm_server_python_interpreter' option " "does not point to a valid Python 3.5+.") python_interpreter = _PathToPythonUsedDuringBuild() if python_interpreter and utils.GetExecutable(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 # interpreter path. python_interpreter = (WIN_PYTHON_PATH if utils.OnWindows() else sys.executable) if _EndsWithPython(python_interpreter): return python_interpreter python_interpreter = utils.PathToFirstExistingExecutable( ['python3', 'python']) if python_interpreter: return python_interpreter raise RuntimeError("Cannot find Python 3.5+. " "Set the 'g:ycm_server_python_interpreter' option " "to a Python interpreter path.")
def __init__(self, user_options): super(CsharpCompleter, self).__init__(user_options) self._solution_for_file = {} self._completer_per_solution = {} self._diagnostic_store = None self._solution_state_lock = threading.Lock() self._roslyn_omnisharp_binary_path = utils.GetExecutable( user_options['roslyn_omnisharp_binary_path']) if not self._roslyn_omnisharp_binary_path: self._roslyn_omnisharp_binary_path = PATH_TO_ROSLYN_OMNISHARP_BINARY if not os.path.isfile(self._roslyn_omnisharp_binary_path): raise RuntimeError( SERVER_NOT_FOUND_MSG.format(PATH_TO_ROSLYN_OMNISHARP_BINARY))
def Get3rdPartyClangd(): pre_built_clangd = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', '..', 'third_party', 'clangd', 'output', 'bin', 'clangd')) pre_built_clangd = utils.GetExecutable(pre_built_clangd) if not CheckClangdVersion(pre_built_clangd): error = 'clangd binary at {} is out-of-date please update.'.format( pre_built_clangd) global REPORTED_OUT_OF_DATE if not REPORTED_OUT_OF_DATE: REPORTED_OUT_OF_DATE = True raise RuntimeError(error) LOGGER.error(error) return None return pre_built_clangd
def PathToPythonInterpreter(): # Not calling the Python interpreter to check its version as it significantly # impacts startup time. from ycmd import utils python_interpreter = vim.eval( 'g:ycm_server_python_interpreter' ) if python_interpreter: python_interpreter = utils.FindExecutable( python_interpreter ) if python_interpreter: return python_interpreter 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 python_interpreter and utils.GetExecutable( 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 # interpreter path. python_interpreter = ( WIN_PYTHON_PATH if utils.OnWindows() else sys.executable ) if _EndsWithPython( python_interpreter ): return python_interpreter # As a last resort, we search python in the PATH. We prefer Python 2 over 3 # for the sake of backwards compatibility with ycm_extra_conf.py files out # there; few people wrote theirs to work on py3. # So we check 'python2' before 'python' because on some distributions (Arch # Linux for example), python refers to python3. python_interpreter = utils.PathToFirstExistingExecutable( [ 'python2', 'python', 'python3' ] ) if python_interpreter: return python_interpreter raise RuntimeError( "Cannot find Python 2.6+ or 3.3+. " "Set the 'g:ycm_server_python_interpreter' option " "to a Python interpreter path." )