From 5ae29af9eefebcbffaad9cec0790280a038f1d0a Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 10 Aug 2018 20:39:55 +0200
Subject: Force use of Python 3.6 for the server on Haiku.

It is not possible to use Python 2 which is built with gcc2, as the
server embeds a clang based .so file.

diff --git a/python/ycm/paths.py b/python/ycm/paths.py
index a135e3a..01285a4 100644
--- a/python/ycm/paths.py
+++ b/python/ycm/paths.py
@@ -57,23 +57,12 @@ def PathToPythonInterpreter():
   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
-
-  # As a last resort, we search python in the PATH. We prefer Python 2 over 3
-  # for the sake of backwards compatibility with ycm_extra_conf.py files out
-  # there; few people wrote theirs to work on py3.
-  # So we check 'python2' before 'python' because on some distributions (Arch
-  # Linux for example), python refers to python3.
-  python_interpreter = utils.PathToFirstExistingExecutable( [ 'python2',
+  # On Haiku we look for python3 first, our python2 is built with gcc2 so it
+  # cannot load the ycm native library.
+  python_interpreter = utils.PathToFirstExistingExecutable( [ 'python3.6',
+                                                              'python3',
                                                               'python',
-                                                              'python3' ] )
+                                                              'python2' ] )
   if python_interpreter:
     return python_interpreter
 
-- 
2.21.0

