0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.1451: difficult to set the python home directories properly

Problem:    It is difficult to set the python home directory properly for
            Python 2.7 and 3.5 since both use $PYTHONHOME.
Solution:   Add the 'pythonhome' and 'pythonthreehome' options. (Kazuki
            Sakamoto, closes #1266)
This commit is contained in:
Bram Moolenaar
2018-01-31 21:49:05 +01:00
parent 1dd45fb4f3
commit 94073167e3
8 changed files with 86 additions and 6 deletions

View File

@@ -912,6 +912,8 @@ python_loaded(void)
}
#endif
static char *py_home_buf = NULL;
static int
Python_Init(void)
{
@@ -929,10 +931,15 @@ Python_Init(void)
}
#endif
if (*p_pyhome != NUL)
{
/* The string must not change later, make a copy in static memory. */
py_home_buf = (char *)vim_strsave(p_pyhome);
if (py_home_buf != NULL)
Py_SetPythonHome(py_home_buf);
}
#ifdef PYTHON_HOME
# ifdef DYNAMIC_PYTHON
if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
# endif
else if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
Py_SetPythonHome(PYTHON_HOME);
#endif