From e73d89fed8da38d7f2eaeb2169801ad379124ae3 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Thu, 3 Dec 2015 23:36:01 -0800 Subject: [PATCH] WORKAROUND: Allow to honor PYTHONHOME environment variable for +python/dyn and +python3/dyn It is temporary fix and it may be changed in the future https://github.com/vim/vim/pull/500 Example: let $PYTHONHOME="/usr/local/Frameworks/Python.framework/Versions/2.7" set pythondll=/usr/local/Frameworks/Python.framework/Versions/2.7/Python --- src/if_python.c | 5 ++++- src/if_python3.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/if_python.c b/src/if_python.c index 1d87cac4d2..1ab8d756df 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -932,7 +932,10 @@ Python_Init(void) #endif #ifdef PYTHON_HOME - Py_SetPythonHome(PYTHON_HOME); +# ifdef DYNAMIC_PYTHON + if (mch_getenv((char_u *)"PYTHONHOME") == NULL) +# endif + Py_SetPythonHome(PYTHON_HOME); #endif init_structs(); diff --git a/src/if_python3.c b/src/if_python3.c index 721e3cc5bb..387b811f61 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -858,7 +858,10 @@ Python3_Init(void) #ifdef PYTHON3_HOME - Py_SetPythonHome(PYTHON3_HOME); +# ifdef DYNAMIC_PYTHON3 + if (mch_getenv((char_u *)"PYTHONHOME") == NULL) +# endif + Py_SetPythonHome(PYTHON3_HOME); #endif PyImport_AppendInittab("vim", Py3Init_vim);