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] update Python's sys.path


This patch causes gdb to update Python's sys.path at startup.
Now, files installed into gdb's data dir will be automatically found.

Tom

2008-11-18  Tom Tromey  <tromey@redhat.com>

	* python/python.c (_initialize_python): Add gdb path to sys.path.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 340213f..989afdb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1256,6 +1256,7 @@ Enables or disables auto-loading of Python code when an object is opened."),
   PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version);
   PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name);
   PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name);
+  PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
 
   gdbpy_initialize_values ();
   gdbpy_initialize_breakpoints ();
@@ -1303,6 +1304,7 @@ class GdbOutputFile:\n\
 \n\
 sys.stderr = GdbOutputFile()\n\
 sys.stdout = GdbOutputFile()\n\
+sys.path.insert(0, gdb.datadir)\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]