This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Add gdb_libdir/python-<version> in front of Python search path.


On Fri, May 21, 2010 at 9:08 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> 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').

I tweaked my patch a bit to only #define WITH_PYTHON_PATH if $build = $host.
I'll let it soak another day and then check in.

[another config parameter to handle where-to-find-build-python vs
where-to-find-runtime-python may yet be a reasonable thing to have,
but I'll leave that for later.  --with-build-python might be a better
choice though]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]