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

updated for version 7.3.062

Problem:    Python doesn't work properly when installed in another directory
            than expected.
Solution:   Figure out home directory in configure and use Py_SetPythonHome()
            at runtime. (Roland Puntaier)
This commit is contained in:
Bram Moolenaar
2010-11-16 19:26:02 +01:00
parent 00b78c17b2
commit 644d37b84d
5 changed files with 159 additions and 23 deletions

View File

@@ -102,7 +102,7 @@ struct PyMethodDef { Py_ssize_t a; };
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
# ifdef PY_NO_RTLD_GLOBAL
# if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
# define load_dll(n) dlopen((n), RTLD_LAZY)
# else
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
@@ -168,6 +168,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define Py_BuildValue dll_Py_BuildValue
# define Py_FindMethod dll_Py_FindMethod
# define Py_InitModule4 dll_Py_InitModule4
# define Py_SetPythonHome dll_Py_SetPythonHome
# define Py_Initialize dll_Py_Initialize
# define Py_Finalize dll_Py_Finalize
# define Py_IsInitialized dll_Py_IsInitialized
@@ -226,6 +227,7 @@ static PyTypeObject* dll_PyType_Type;
static PyObject*(*dll_Py_BuildValue)(char *, ...);
static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *);
static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int);
static void(*dll_Py_SetPythonHome)(char *home);
static void(*dll_Py_Initialize)(void);
static void(*dll_Py_Finalize)(void);
static int(*dll_Py_IsInitialized)(void);
@@ -310,6 +312,7 @@ static struct
# else
{"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
# endif
{"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
{"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
{"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
@@ -349,7 +352,7 @@ python_runtime_link_init(char *libname, int verbose)
{
int i;
#if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3)
#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
/* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */
@@ -543,6 +546,10 @@ Python_Init(void)
}
#endif
#ifdef PYTHON_HOME
Py_SetPythonHome(PYTHON_HOME);
#endif
init_structs();
#if !defined(MACOS) || defined(MACOS_X_UNIX)