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
