From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27541 invoked by alias); 21 May 2010 16:08:58 -0000 Received: (qmail 27182 invoked by uid 22791); 21 May 2010 16:08:52 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 May 2010 16:08:45 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4LG8Ho6031398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 May 2010 12:08:17 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4LG8GsN020961; Fri, 21 May 2010 12:08:16 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4LG8FAd029319; Fri, 21 May 2010 12:08:16 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 5258C37818E; Fri, 21 May 2010 10:08:15 -0600 (MDT) From: Tom Tromey To: Doug Evans Cc: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Add gdb_libdir/python- in front of Python search path. References: <1274380803-25266-1-git-send-email-brobecker@adacore.com> <1274380803-25266-3-git-send-email-brobecker@adacore.com> Reply-To: tromey@redhat.com Date: Fri, 21 May 2010 16:17:00 -0000 In-Reply-To: (Doug Evans's message of "Fri, 21 May 2010 01:43:52 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00496.txt.bz2 >>>>> "Doug" == Doug Evans writes: Doug> I think(!) this is a better approach. Could be wrong of course. :-) Doug> I think adding one directory to sys.path is insufficient, and from Doug> what I've read it seems like Py_SetProgramName is the preferred Doug> solution to this problem. I read through this thread. I also prefer this approach, mostly because it doesn't change sys.path for the distro case. Doug> This patch doesn't currently handle your case, where the relationship Doug> between the location of python and gdb at build time is different than Doug> at runtime. I think the solution to that is another config parameter Doug> to specify where to find python at run time. Currently, when given a Doug> path, --with-python specifies where to find python at build time, and, Doug> for now, also at runtime. According to the docs you can also override some Py_ functions to allow more complete control: The embedding application can steer the search by calling `Py_SetProgramName(FILE)' _before_ calling `Py_Initialize()'. Note that `PYTHONHOME' still overrides this and `PYTHONPATH' is still inserted in front of the standard path. An application that requires total control has to provide its own implementation of `Py_GetPath()' , `Py_GetPrefix()' , `Py_GetExecPrefix()' , and `Py_GetProgramFullPath()' (all defined in `Modules/getpath.c'). Tom