Auto merge of #3273 - micbou:remove-server-utils-dependency, r=puremourning

[READY] Remove server_utils dependency

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/3273)
<!-- Reviewable:end -->
This commit is contained in:
zzbot 2018-12-28 00:32:59 -08:00 committed by GitHub
commit 1e37efe648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. # We enclose this code in a try/except block to avoid backtraces in Vim.
try: 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. # The python-future module must be inserted after the standard library path.
from ycmd.server_utils import GetStandardLibraryIndexInSysPath
sys.path.insert( GetStandardLibraryIndexInSysPath() + 1, sys.path.insert( GetStandardLibraryIndexInSysPath() + 1,
p.join( third_party_folder, 'python-future', 'src' ) ) 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, from ycm.buffer import ( BufferDict,
DIAGNOSTIC_UI_FILETYPES, DIAGNOSTIC_UI_FILETYPES,
DIAGNOSTIC_UI_ASYNC_FILETYPES ) DIAGNOSTIC_UI_ASYNC_FILETYPES )
from ycmd import server_utils, utils from ycmd import utils
from ycmd.request_wrap import RequestWrap from ycmd.request_wrap import RequestWrap
from ycm.omni_completer import OmniCompleter from ycm.omni_completer import OmniCompleter
from ycm import syntax_parse from ycm import syntax_parse
@ -252,21 +252,21 @@ class YouCompleteMe( object ):
return_code = self._server_popen.poll() return_code = self._server_popen.poll()
logfile = os.path.basename( self._server_stderr ) logfile = os.path.basename( self._server_stderr )
if return_code == server_utils.CORE_UNEXPECTED_STATUS: # See https://github.com/Valloric/ycmd#exit-codes for the list of exit
error_message = CORE_UNEXPECTED_MESSAGE.format( # codes.
logfile = logfile ) if return_code == 3:
elif return_code == server_utils.CORE_MISSING_STATUS: error_message = CORE_UNEXPECTED_MESSAGE.format( logfile = logfile )
elif return_code == 4:
error_message = CORE_MISSING_MESSAGE error_message = CORE_MISSING_MESSAGE
elif return_code == server_utils.CORE_PYTHON2_STATUS: elif return_code == 5:
error_message = CORE_PYTHON2_MESSAGE error_message = CORE_PYTHON2_MESSAGE
elif return_code == server_utils.CORE_PYTHON3_STATUS: elif return_code == 6:
error_message = CORE_PYTHON3_MESSAGE error_message = CORE_PYTHON3_MESSAGE
elif return_code == server_utils.CORE_OUTDATED_STATUS: elif return_code == 7:
error_message = CORE_OUTDATED_MESSAGE error_message = CORE_OUTDATED_MESSAGE
else: else:
error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format( error_message = EXIT_CODE_UNEXPECTED_MESSAGE.format( code = return_code,
code = return_code, logfile = logfile )
logfile = logfile )
error_message = SERVER_SHUTDOWN_MESSAGE + ' ' + error_message error_message = SERVER_SHUTDOWN_MESSAGE + ' ' + error_message
self._logger.error( error_message ) self._logger.error( error_message )