From 0c4a40633c767da2c7659a3f460cf1e8e3dd3a5c Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 27 May 2010 03:40:45 +0000 Subject: Allow python to find its files if moved from original location. * acinclude.m4 (GDB_AC_DEFINE_RELOCATABLE): New function. (GDB_AC_WITH_DIR): Call it. * configure.ac: Define WITH_PYTHON_PATH if we can find the python installation directory. * config.in: Regenerate. * configure: Regenerate. * defs.h (python_libdir): Declare. * main.c (python_libdir): Define. (captured_main): Initialize python_libdir. * python/python.c (_initialize_python): #ifdef WITH_PYTHON_PATH, call Py_SetProgramName to make sure python can find its libraries and modules. --- gdb/python/python.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index 288c701..0b7b7ba 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -647,6 +647,17 @@ Enables or disables printing of Python stack traces."), &show_python_list); #ifdef HAVE_PYTHON +#ifdef WITH_PYTHON_PATH + /* Work around problem where python gets confused about where it is, + and then can't find its libraries, etc. + NOTE: Python assumes the following layout: + /foo/bin/python + /foo/lib/pythonX.Y/... + This must be done before calling Py_Initialize. */ + Py_SetProgramName (concat (ldirname (python_libdir), SLASH_STRING, "bin", + SLASH_STRING, "python", NULL)); +#endif + Py_Initialize (); PyEval_InitThreads (); -- cgit v1.1