0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -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

@@ -80,7 +80,7 @@ static void init_structs(void);
# 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)
@@ -132,6 +132,7 @@ static void init_structs(void);
# define PyType_Ready py3_PyType_Ready
#undef Py_BuildValue
# define Py_BuildValue py3_Py_BuildValue
# define Py_SetPythonHome py3_Py_SetPythonHome
# define Py_Initialize py3_Py_Initialize
# define Py_Finalize py3_Py_Finalize
# define Py_IsInitialized py3_Py_IsInitialized
@@ -170,6 +171,7 @@ static void init_structs(void);
* Pointers for dynamic link
*/
static int (*py3_PySys_SetArgv)(int, wchar_t **);
static void (*py3_Py_SetPythonHome)(wchar_t *home);
static void (*py3_Py_Initialize)(void);
static PyObject* (*py3_PyList_New)(Py_ssize_t size);
static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
@@ -254,6 +256,7 @@ static struct
} py3_funcname_table[] =
{
{"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
{"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
{"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
{"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
@@ -336,7 +339,7 @@ py3_runtime_link_init(char *libname, int verbose)
int i;
void *ucs_from_string, *ucs_from_string_and_size;
# if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON)
# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON)
/* 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. */
@@ -539,6 +542,11 @@ Python3_Init(void)
init_structs();
#ifdef PYTHON3_HOME
Py_SetPythonHome(PYTHON3_HOME);
#endif
/* initialise threads */
PyEval_InitThreads();