setup.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. from __future__ import unicode_literals
  18. from __future__ import print_function
  19. from __future__ import division
  20. from __future__ import absolute_import
  21. # No imports from `future` because when this is loaded, sys.path hasn't been set
  22. # up yet!
  23. import sys
  24. import os
  25. # Can't import these from paths.py because that uses `future` imports
  26. DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
  27. DIR_OF_YCMD = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', '..', 'third_party',
  28. 'ycmd' )
  29. def SetUpSystemPaths():
  30. sys.path.insert( 0, os.path.join( DIR_OF_YCMD ) )
  31. from ycmd import server_utils as su
  32. su.AddNearestThirdPartyFoldersToSysPath( DIR_OF_CURRENT_SCRIPT )
  33. # We need to import ycmd's third_party folders as well since we import and
  34. # use ycmd code in the client.
  35. su.AddNearestThirdPartyFoldersToSysPath( su.__file__ )
  36. def SetUpYCM():
  37. from ycm import base
  38. from ycmd import user_options_store
  39. from ycm.youcompleteme import YouCompleteMe
  40. base.LoadJsonDefaultsIntoVim()
  41. user_options_store.SetAll( base.BuildServerConf() )
  42. return YouCompleteMe( user_options_store.GetAll() )