diff --git a/moo.kdevelop b/moo.kdevelop index 2d5c8d0a..6de885bc 100644 --- a/moo.kdevelop +++ b/moo.kdevelop @@ -46,7 +46,7 @@ - --enable-debug=full --enable-all-gcc-warnings=fatal --disable-moo-module + --enable-debug=full --enable-all-gcc-warnings=fatal --disable-moo-module build/debug kdevgccoptions kdevgppoptions diff --git a/moo/mooedit/mooplugin.c b/moo/mooedit/mooplugin.c index f3f2b241..2785f2c1 100644 --- a/moo/mooedit/mooplugin.c +++ b/moo/mooedit/mooplugin.c @@ -920,7 +920,7 @@ moo_plugin_init_builtin (void) #endif #endif _moo_active_strings_plugin_init (); -#ifdef MOO_USE_PYGTK +#if defined(MOO_USE_PYGTK) && !defined(__WIN32__) _moo_python_plugin_init (); #endif } diff --git a/moo/moopython/Makefile.incl b/moo/moopython/Makefile.incl index b1685dcf..13d8d6dd 100644 --- a/moo/moopython/Makefile.incl +++ b/moo/moopython/Makefile.incl @@ -11,6 +11,11 @@ moopython_sources = \ $(moopython)/mooplugin-python.c \ $(moopython)/mooplugin-python.h +moopython_built_sources = +moopython_nodist_sources = +moopython_cleanfiles = + if MOO_USE_PYGTK -moo_sources += $(moopython_sources) +if !MOO_OS_MINGW +endif endif diff --git a/moo/moopython/mooplugin-python.c b/moo/moopython/mooplugin-python.c index 615d99a3..e88398f3 100644 --- a/moo/moopython/mooplugin-python.c +++ b/moo/moopython/mooplugin-python.c @@ -92,15 +92,18 @@ err_print (void) static gboolean moo_python_api_init (void) { - static MooPyAPI moo_py_api = { + static MooPyAPI api = { incref, decref, err_print, run_string, run_file }; g_return_val_if_fail (!moo_python_running(), FALSE); - if (!moo_python_init (MOO_PY_API_VERSION, &moo_py_api)) + if (!moo_python_init (MOO_PY_API_VERSION, &api)) + { + g_warning ("%s: oops", G_STRLOC); return FALSE; + } Py_Initialize (); @@ -120,6 +123,8 @@ moo_python_plugin_read_file (const char *path) g_return_if_fail (path != NULL); + g_message ("%s: reading %s", G_STRLOC, path); + if (!g_file_get_contents (path, &content, NULL, &error)) { g_warning ("%s: could not read plugin file", G_STRLOC); @@ -162,6 +167,8 @@ moo_python_plugin_read_dir (const char *path) g_return_if_fail (path != NULL); + g_message ("%s: reading dir %s", G_STRLOC, path); + dir = g_dir_open (path, 0, NULL); if (!dir) @@ -208,7 +215,10 @@ _moo_python_plugin_init (void) return FALSE; if (!_moo_pygtk_init ()) + { + PyErr_Print (); return FALSE; + } moo_python_plugin_read_dirs (); return TRUE; @@ -225,6 +235,15 @@ _moo_python_plugin_deinit (void) } +#ifdef MOO_PYTHON_PLUGIN +gboolean MOO_PYTHON_INIT_FUNC (void) +{ + g_message ("%s: hi there", G_STRLOC); + return _moo_python_plugin_init (); +} +#endif + + /***************************************************************************/ /* Python plugins */ diff --git a/moo/moopython/pygtk/Makefile.incl b/moo/moopython/pygtk/Makefile.incl index 6ffa7963..81efe5dc 100644 --- a/moo/moopython/pygtk/Makefile.incl +++ b/moo/moopython/pygtk/Makefile.incl @@ -148,11 +148,18 @@ $(moopygtk)/mooterm-mod.h: $(moopygtk)/mooterm-mod.py $(PY2H) mkdir -p $(moopygtk) sh $(PY2H) MOO_TERM_PY $(moopygtk_srcdir)/mooterm-mod.py > $(moopygtk)/mooterm-mod.h +moopython_sources += $(moopygtk_sources) +moopython_nodist_sources += $(nodist_moopygtk_sources) +moopython_built_sources += $(moopygtk_built_sources) +moopython_cleanfiles += $(moopygtk_cleanfiles) + if MOO_USE_PYGTK -moo_sources += $(moopygtk_sources) -moo_built_sources += $(moopygtk_built_sources) -moo_nodist_sources += $(nodist_moopygtk_sources) -moo_cleanfiles += $(moopygtk_cleanfiles) +if !MOO_OS_MINGW +moo_built_sources += $(moopython_built_sources) +moo_nodist_sources += $(moopython_nodist_sources) +moo_cleanfiles += $(moopython_cleanfiles) +moo_sources += $(moopython_sources) +endif endif moo_extra_dist += $(moopygtk_extra_dist) diff --git a/moo/mooutils/moopython.c b/moo/mooutils/moopython.c index 228e15c4..9fe5cc29 100644 --- a/moo/mooutils/moopython.c +++ b/moo/mooutils/moopython.c @@ -14,7 +14,7 @@ #include "mooutils/moopython.h" -MooPyAPI *_moo_py_api = NULL; +MooPyAPI *moo_py_api = NULL; gboolean moo_python_init (guint version, @@ -23,8 +23,8 @@ moo_python_init (guint version, if (version != MOO_PY_API_VERSION) return FALSE; - g_return_val_if_fail (!_moo_py_api || !api, FALSE); + g_return_val_if_fail (!moo_py_api || !api, FALSE); - _moo_py_api = api; + moo_py_api = api; return TRUE; } diff --git a/moo/mooutils/moopython.h b/moo/mooutils/moopython.h index fd374017..bacd8476 100644 --- a/moo/mooutils/moopython.h +++ b/moo/mooutils/moopython.h @@ -35,19 +35,19 @@ struct _MooPyAPI { }; -extern MooPyAPI *_moo_py_api; +extern MooPyAPI *moo_py_api; gboolean moo_python_init (guint version, MooPyAPI *api); -#define moo_python_running() (_moo_py_api != NULL) +#define moo_python_running() (moo_py_api != NULL) -#define moo_Py_INCREF _moo_py_api->incref -#define moo_Py_DECREF _moo_py_api->decref -#define moo_PyErr_Print _moo_py_api->err_print +#define moo_Py_INCREF moo_py_api->incref +#define moo_Py_DECREF moo_py_api->decref +#define moo_PyErr_Print moo_py_api->err_print -#define moo_python_run_string _moo_py_api->run_string -#define moo_python_run_file _moo_py_api->run_file +#define moo_python_run_string moo_py_api->run_string +#define moo_python_run_file moo_py_api->run_file G_END_DECLS