From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27911 invoked by alias); 8 Feb 2010 19:30:02 -0000 Received: (qmail 27852 invoked by uid 22791); 8 Feb 2010 19:30:01 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Feb 2010 19:29:58 +0000 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id o18JTn1V012403 for ; Mon, 8 Feb 2010 19:29:50 GMT Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by wpaz33.hot.corp.google.com with ESMTP id o18JTmOw007398 for ; Mon, 8 Feb 2010 11:29:49 -0800 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id D971F84415; Mon, 8 Feb 2010 11:29:42 -0800 (PST) To: gdb-patches@sourceware.org Subject: [RFC] Help python find its files Message-Id: <20100208192942.D971F84415@ruffy.mtv.corp.google.com> Date: Mon, 08 Feb 2010 19:30:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00222.txt.bz2 Hi. We had problems with python not being able to find its files. This may be specific to installations where gdb and python are installed in different places. 2010-02-08 Doug Evans * configure.ac (--with-python): Define WITH_PYTHON_PATH if --with-python arg is a path. * config.in: Regenerated. * configure: Regenerated. * python/python.c (_initialize_python): If configured --with-python=/path, pass a fake argv[0] to Py_SetProgramName so python can find its files. Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.114 diff -u -p -r1.114 configure.ac --- configure.ac 25 Jan 2010 13:22:02 -0000 1.114 +++ configure.ac 8 Feb 2010 19:08:11 -0000 @@ -652,6 +657,13 @@ else AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.]) fi fi + if test ${have_libpython} = yes; then + case "${with_python}" in + /*) + AC_DEFINE_UNQUOTED(WITH_PYTHON_PATH, "${with_python}", [Define if --with-python contains a path.]) + ;; + esac + fi if test ${have_libpython} = no; then case "${with_python}" in yes) Index: python/python.c =================================================================== RCS file: /cvs/src/src/gdb/python/python.c,v retrieving revision 1.25 diff -u -p -r1.25 python.c --- python/python.c 18 Jan 2010 10:50:44 -0000 1.25 +++ python/python.c 8 Feb 2010 19:08:11 -0000 @@ -631,6 +631,12 @@ Enables or disables auto-loading of Pyth &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. + Lie and pretend argv[0] is in WITH_PYTHON_PATH. */ + Py_SetProgramName(WITH_PYTHON_PATH "/bin/python"); +#endif Py_Initialize (); PyEval_InitThreads ();