This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

[python] read gdb's __init__.py


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.  */


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