setup.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (C) 2016 YouCompleteMe contributors
  2. #
  3. # This file is part of YouCompleteMe.
  4. #
  5. # YouCompleteMe is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # YouCompleteMe is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
  17. import sys
  18. import os
  19. import paths
  20. def SetUpSystemPaths():
  21. sys.path.insert( 0, os.path.join( paths.DIR_OF_YCMD ) )
  22. from ycmd import server_utils as su
  23. su.AddNearestThirdPartyFoldersToSysPath( paths.DIR_OF_CURRENT_SCRIPT )
  24. # We need to import ycmd's third_party folders as well since we import and
  25. # use ycmd code in the client.
  26. su.AddNearestThirdPartyFoldersToSysPath( su.__file__ )
  27. def SetUpYCM():
  28. import base
  29. from ycmd import user_options_store, utils
  30. from youcompleteme import YouCompleteMe
  31. base.LoadJsonDefaultsIntoVim()
  32. user_options_store.SetAll( base.BuildServerConf() )
  33. popen_args = [ paths.PathToPythonInterpreter(),
  34. paths.PathToCheckCoreVersion() ]
  35. if utils.SafePopen( popen_args ).wait() == 2:
  36. raise RuntimeError( 'YCM support libs too old, PLEASE RECOMPILE.' )
  37. return YouCompleteMe( user_options_store.GetAll() )