[gcompris-devel] Coding custom Python plugins without make install

Olivier Berger olivier.berger at int-evry.fr
Wed Apr 23 09:33:16 UTC 2003


Hi.

I suggest a little patch to be able to code plugins in Python in
~/.gcompris/Plugins/python/

The followin code should do it somehow.

Regards,


Index: python.c
===================================================================
RCS file: /cvs/gnome/gcompris/src/boards/python.c,v
retrieving revision 1.3
diff -u -r1.3 python.c
--- python.c	17 Apr 2003 18:01:06 -0000	1.3
+++ python.c	23 Apr 2003 16:29:41 -0000
@@ -96,6 +96,7 @@
   static char* python_prog_name="gcompris";
   char* boarddir;
   char* boardclass;
+  gchar *userplugindir;
   
   if(agcomprisBoard!=NULL){
     /* Initialize the python interpreter */
@@ -117,9 +118,18 @@
     }
 
     /* Add the python plugins dir to the python's search path */
-    boarddir = g_strdup_printf("import sys; sys.path.append('%s/python')",PLUGIN_DIR); 
+#ifndef DISABLE_USER_PLUGIN_DIR
+    userplugindir = g_strconcat(g_get_home_dir(), "/.gcompris/Plugins/", NULL);
+    boarddir = g_strdup_printf("import sys; sys.path.append('%s/python'); sys.path.append('%s/python')", userplugindir, PLUGIN_DIR); 
+#else
+    boarddir = g_strdup_printf("import sys; sys.path.append('%s/python')",PLUGIN_DIR ); 
+#endif
     PyRun_SimpleString(boarddir); 
     g_free(boarddir); 
+#ifndef DISABLE_USER_PLUGIN_DIR
+    g_free(userplugindir);
+#endif
+
 
     /* Load the gcompris modules */
     python_gcompris_module_init();


-- 
Olivier BERGER <olivier.berger at int-evry.fr>
Ingénieur Recherche - Dept INF
INT Evry (http://www.int-evry.fr)
OpenPGP-Id: 1024D/6B829EEC






More information about the Gcompris-devel mailing list