From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32754 invoked by alias); 21 May 2010 15:54:29 -0000 Received: (qmail 32741 invoked by uid 22791); 21 May 2010 15:54:28 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 May 2010 15:54:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 382172BAB3D; Fri, 21 May 2010 11:54:19 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EQAkUMeVO-I5; Fri, 21 May 2010 11:54:19 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 041562BAB3B; Fri, 21 May 2010 11:54:18 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 5B0F8F58FA; Fri, 21 May 2010 08:54:15 -0700 (PDT) Date: Fri, 21 May 2010 16:01:00 -0000 From: Joel Brobecker To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Add gdb_libdir/python- in front of Python search path. Message-ID: <20100521155415.GU3019@adacore.com> References: <1274380803-25266-1-git-send-email-brobecker@adacore.com> <1274380803-25266-3-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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-05/txt/msg00494.txt.bz2 > I think(!) this is a better approach. Could be wrong of course. :-) > I think adding one directory to sys.path is insufficient, and from > what I've read it seems like Py_SetProgramName is the preferred > solution to this problem. ISTM for your research (thank you!) that not only is this a better solution, but most likely the only really viable solution. We're going to have to go with ${gdb_libdir=/lib/gdb}/python/lib/python2.6. > This patch doesn't currently handle your case, where the relationship > between the location of python and gdb at build time is different than > at runtime. I think the solution to that is another config parameter > to specify where to find python at run time. Currently, when given a > path, --with-python specifies where to find python at build time, and, > for now, also at runtime. > I can create another patch to add this new option > (--with-python-libdir or some such) if you think it's worth pursuing. I think we can work around it, by simply making sure that python is already installed at desired location relative to the prefix used for configuration. In any case, if I need the extra option, I can take care of that part. > Regardless of whether --with-python-libdir is useful to add to the FSF > tree, I think the attached patch is worthy. I agree. > 2010-05-21 Doug Evans > > 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: If a path is provided to --with-python, > define WITH_PYTHON_PATH. > * 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): If configured with > --with-python=/path, call Py_SetProgramName to make sure python > can find its libraries and modules. I read the patch as carefully as I could, and nothing jumped out. -- Joel