This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] read gdb's __init__.py
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Sun, 23 Nov 2008 10:43:33 -0700
- Subject: [python] read gdb's __init__.py
- Reply-to: tromey at redhat dot com
Due to the funny way we initialize the 'gdb' module in python, if
there is a non-trivial gdb/__init__.py, it won't be read. This patch
changes gdb to explicitly read this file if it exists... kind of a
hack, but as far as I can tell, this is what we have to do.
This lets us put default code into that __init__.py, should we want
to.
Tom
2008-11-23 Tom Tromey <tromey@redhat.com>
* python/python.c (_initialize_python): Read gdb's __init__.py.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 716d63f..52860eb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1302,6 +1302,10 @@ sys.stdout = GdbOutputFile()\n\
if hasattr (gdb, 'datadir'):\n\
sys.path.insert(0, gdb.datadir + '/python')\n\
gdb.__path__ = [gdb.datadir + '/python/gdb']\n\
+ from os.path import exists\n\
+ ipy = gdb.datadir + '/python/gdb/__init__.py'\n\
+ if exists (ipy):\n\
+ execfile (ipy)\n\
");
/* Release the GIL while gdb runs. */