Remove server_utils dependency

This commit is contained in:
micbou 2018-12-19 13:54:23 +01:00
parent 0790dc99b4
commit 88504eb44a
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
2 changed files with 17 additions and 12 deletions

View File

@ -216,8 +216,13 @@ sys.path[ 0:0 ] = dependencies
# We enclose this code in a try/except block to avoid backtraces in Vim.
try:
def GetStandardLibraryIndexInSysPath():
for index, path in enumerate( sys.path ):
if p.isfile( p.join( path, 'os.py' ) ):
return index
raise RuntimeError( 'Could not find standard library path in Python path.' )
# The python-future module must be inserted after the standard library path.
from ycmd.server_utils import GetStandardLibraryIndexInSysPath
sys.path.insert( GetStandardLibraryIndexInSysPath() + 1,
p.join( third_party_folder, 'python-future', 'src' ) )

View File

@ -35,7 +35,7 @@ from ycm import base, paths, vimsupport
from ycm.buffer import ( BufferDict,
DIAGNOSTIC_UI_FILETYPES,
DIAGNOSTIC_UI_ASYNC_FILETYPES )
from ycmd import server_utils, utils
from ycmd import utils
from ycmd.request_wrap import RequestWrap
from ycm.omni_completer import OmniCompleter
from ycm import syntax_parse
@ -252,20 +252,20 @@ class YouCompleteMe( object ):
return_code = self._server_popen.poll()
logfile = os.path.basename( self._server_stderr )
if return_code == server_utils.CORE_UNEXPECTED_STATUS:
error_message = CORE_UNEXPECTED_MESSAGE.format(
logfile = logfile )
elif return_code == server_utils.CORE_MISSING_STATUS:
# See https://github.com/Valloric/ycmd#exit-codes for the list of exit
# codes.
if return_code == 3:
error_message = CORE_UNEXPECTED_MESSAGE.format( logfile = logfile )
elif return_code == 4:
error_message = CORE_MISSING_MESSAGE
elif return_code == server_utils.CORE_PYTHON2_STATUS:
elif return_code == 5:
error_message = CORE_PYTHON2_MESSAGE
elif return_code == server_utils.CORE_PYTHON3_STATUS:
elif return_code == 6:
error_message = CORE_PYTHON3_MESSAGE
elif return_code == server_utils.CORE_OUTDATED_STATUS:
elif return_code == 7:
error_message = CORE_OUTDATED_MESSAGE
else:
error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format(
code = return_code,
error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format( code = return_code,
logfile = logfile )
error_message = SERVER_SHUTDOWN_MESSAGE + ' ' + error_message