r1480@localhost: muntyan | 2005-12-23 02:23:01 -0600
Python stuff once again. Now builds on windows (and on unix, too)master
parent
dd2e637212
commit
48cf5e8aac
|
@ -46,7 +46,7 @@
|
|||
</run>
|
||||
<configurations>
|
||||
<debug>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --disable-moo-module</configargs>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --disable-moo-module </configargs>
|
||||
<builddir>build/debug</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue