comparison src/if_python.c @ 13154:53cc7ea77c54 v8.0.1451

patch 8.0.1451: difficult to set the python home directories properly commit https://github.com/vim/vim/commit/94073167e3aa8cbe18380e93a2fc8e8165438cc8 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 31 21:49:05 2018 +0100 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)
author Christian Brabandt <cb@256bit.org>
date Wed, 31 Jan 2018 22:00:07 +0100
parents 351cf7c67bbe
children 8412df1479a3
comparison
equal deleted inserted replaced
13153:c30f721849cb 13154:53cc7ea77c54
910 { 910 {
911 return (hinstPython != 0); 911 return (hinstPython != 0);
912 } 912 }
913 #endif 913 #endif
914 914
915 static char *py_home_buf = NULL;
916
915 static int 917 static int
916 Python_Init(void) 918 Python_Init(void)
917 { 919 {
918 if (!initialised) 920 if (!initialised)
919 { 921 {
927 EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); 929 EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded."));
928 goto fail; 930 goto fail;
929 } 931 }
930 #endif 932 #endif
931 933
934 if (*p_pyhome != NUL)
935 {
936 /* The string must not change later, make a copy in static memory. */
937 py_home_buf = (char *)vim_strsave(p_pyhome);
938 if (py_home_buf != NULL)
939 Py_SetPythonHome(py_home_buf);
940 }
932 #ifdef PYTHON_HOME 941 #ifdef PYTHON_HOME
933 # ifdef DYNAMIC_PYTHON 942 else if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
934 if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
935 # endif
936 Py_SetPythonHome(PYTHON_HOME); 943 Py_SetPythonHome(PYTHON_HOME);
937 #endif 944 #endif
938 945
939 init_structs(); 946 init_structs();
940 947