1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
Description: Use Debian's ycmd package locations for ycmd.
We neither have the third_party directory for vim-youcompleteme nor
for ycmd, so we can't import them and we don't want to either.
.
This means we can drop lots and lots of complicated code as we know
by virtue of dependencies where everything is and that it is good
Author: David Kalnischkies <donkult@debian.org>
Forwarded: not needed
Last-Update: 2020-10-28
--- a/autoload/youcompleteme.vim
+++ b/autoload/youcompleteme.vim
@@ -266,17 +266,13 @@
function! s:SetUpPython() abort
py3 << EOF
-import os.path as p
import sys
import traceback
import vim
-root_folder = p.normpath( p.join( vim.eval( 's:script_folder_path' ), '..' ) )
-third_party_folder = p.join( root_folder, 'third_party' )
-
# Add dependencies to Python path.
-sys.path[ 0:0 ] = [ p.join( root_folder, 'python' ),
- p.join( third_party_folder, 'ycmd' ) ]
+sys.path[ 0:0 ] = [ '/usr/share/vim-youcompleteme/python',
+ '/usr/lib/ycmd' ]
# We enclose this code in a try/except block to avoid backtraces in Vim.
try:
--- a/python/ycm/paths.py
+++ b/python/ycm/paths.py
@@ -15,68 +15,27 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
-import os
import sys
import vim
-import re
-
-# Can't import these from setup.py because it makes nosetests go crazy.
-DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
-DIR_OF_YCMD = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', '..', 'third_party',
- 'ycmd' )
-WIN_PYTHON_PATH = os.path.join( sys.exec_prefix, 'python.exe' )
-PYTHON_BINARY_REGEX = re.compile(
- r'python(3(\.[6-9])?)?(.exe)?$', re.IGNORECASE )
# Not caching the result of this function; users shouldn't have to restart Vim
# after running the install script or setting the
# `g:ycm_server_python_interpreter` option.
def PathToPythonInterpreter():
+ python_interpreter = vim.eval( 'g:ycm_server_python_interpreter' )
+ if not python_interpreter:
+ return sys.executable
+
# 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.6+." )
-
- 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' ] )
+ python_interpreter = utils.FindExecutable( python_interpreter )
if python_interpreter:
return python_interpreter
- raise RuntimeError( "Cannot find Python 3.6+. "
- "Set the 'g:ycm_server_python_interpreter' option "
- "to a Python interpreter path." )
-
-
-def _PathToPythonUsedDuringBuild():
- from ycmd import utils
-
- try:
- filepath = os.path.join( DIR_OF_YCMD, 'PYTHON_USED_DURING_BUILDING' )
- return utils.ReadFile( filepath ).strip()
- except OSError:
- return None
+ raise RuntimeError( "Path in 'g:ycm_server_python_interpreter' option "
+ "does not point to a valid Python 3.6+." )
def _EndsWithPython( path ):
@@ -85,4 +44,4 @@
def PathToServerScript():
- return os.path.join( DIR_OF_YCMD, 'ycmd' )
+ return "/usr/bin/ycmd"
--- a/python/ycm/base.py
+++ b/python/ycm/base.py
@@ -18,7 +18,7 @@
import os
import json
-from ycm import vimsupport, paths
+from ycm import vimsupport
from ycmd import identifier_utils
YCM_VAR_PREFIX = 'ycm_'
@@ -35,9 +35,7 @@
# omnicompleter) don't have to constantly check for values being present, and
# so that we don't jave to dulicate the list of server settings in
# youcomplete.vim
- defaults_file = os.path.join( paths.DIR_OF_YCMD,
- 'ycmd',
- 'default_settings.json' )
+ defaults_file = '/usr/lib/ycmd/ycmd/default_settings.json'
if os.path.exists( defaults_file ):
with open( defaults_file ) as defaults_file_handle:
user_options = json.load( defaults_file_handle )
--- a/.ycm_extra_conf.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# This file is NOT licensed under the GPLv3, which is the license for the rest
-# of YouCompleteMe.
-#
-# Here's the license text for this file:
-#
-# This is free and unencumbered software released into the public domain.
-#
-# Anyone is free to copy, modify, publish, use, compile, sell, or
-# distribute this software, either in source code form or as a compiled
-# binary, for any purpose, commercial or non-commercial, and by any
-# means.
-#
-# In jurisdictions that recognize copyright laws, the author or authors
-# of this software dedicate any and all copyright interest in the
-# software to the public domain. We make this dedication for the benefit
-# of the public at large and to the detriment of our heirs and
-# successors. We intend this dedication to be an overt act of
-# relinquishment in perpetuity of all present and future rights to this
-# software under copyright law.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-# For more information, please refer to <http://unlicense.org/>
-
-import os.path as p
-import subprocess
-
-DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
-DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
-
-
-def GetStandardLibraryIndexInSysPath( sys_path ):
- 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.' )
-
-
-def PythonSysPath( **kwargs ):
- sys_path = kwargs[ 'sys_path' ]
-
- dependencies = [ p.join( DIR_OF_THIS_SCRIPT, 'python' ),
- p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
- p.join( DIR_OF_THIRD_PARTY, 'ycmd' ),
- p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ),
- p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ),
- p.join( DIR_OF_THIRD_PARTY,
- 'requests_deps',
- 'urllib3',
- 'src' ),
- p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ),
- p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ) ]
-
- # The concurrent.futures module is part of the standard library on Python 3.
- interpreter_path = kwargs[ 'interpreter_path' ]
- major_version = int( subprocess.check_output( [
- interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
- ).rstrip().decode( 'utf8' ) )
- if major_version == 2:
- dependencies.append( p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) )
-
- sys_path[ 0:0 ] = dependencies
- sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
- p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) )
-
- return sys_path
|