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
@@ -241,28 +241,12 @@
 
 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.
-dependencies = [ p.join( root_folder, 'python' ),
-                 p.join( third_party_folder, 'requests-futures' ),
-                 p.join( third_party_folder, 'ycmd' ),
-                 p.join( third_party_folder, 'requests_deps', 'idna' ),
-                 p.join( third_party_folder, 'requests_deps', 'chardet' ),
-                 p.join( third_party_folder,
-                         'requests_deps',
-                         'urllib3',
-                         'src' ),
-                 p.join( third_party_folder, 'requests_deps', 'certifi' ),
-                 p.join( third_party_folder, 'requests_deps', 'requests' ) ]
-
-sys.path[ 0:0 ] = dependencies
+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 )
