--- a/python/gplugin-python3-core.c Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-core.c Sat Feb 22 04:00:07 2020 -0600
@@ -52,10 +52,10 @@
gplugin_load(GPluginNativePlugin *plugin,
G_GNUC_UNUSED GError **error)
- gplugin_python_plugin_register(plugin);
- gplugin_python_loader_register(plugin);
+ gplugin_python3_plugin_register(plugin); + gplugin_python3_loader_register(plugin); - gplugin_manager_register_loader(GPLUGIN_PYTHON_TYPE_LOADER);
+ gplugin_manager_register_loader(GPLUGIN_PYTHON3_TYPE_LOADER); --- a/python/gplugin-python3-loader.c Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-loader.c Sat Feb 22 04:00:07 2020 -0600
@@ -28,27 +28,27 @@
-struct _GPluginPythonLoader {
+struct _GPluginPython3Loader { PyThreadState *py_thread_state;
-G_DEFINE_DYNAMIC_TYPE(GPluginPythonLoader, gplugin_python_loader, GPLUGIN_TYPE_LOADER);
+G_DEFINE_DYNAMIC_TYPE(GPluginPython3Loader, gplugin_python3_loader, GPLUGIN_TYPE_LOADER); /******************************************************************************
* GPluginLoader Implementation
*****************************************************************************/
-gplugin_python_loader_class_supported_extensions(G_GNUC_UNUSED GPluginLoaderClass *klass) {
+gplugin_python3_loader_class_supported_extensions(G_GNUC_UNUSED GPluginLoaderClass *klass) { return g_slist_append(NULL, "py");
-gplugin_python_loader_query(GPluginLoader *loader,
- G_GNUC_UNUSED GError **error)
+gplugin_python3_loader_query(GPluginLoader *loader, + G_GNUC_UNUSED GError **error) GPluginPlugin *plugin = NULL;
@@ -65,11 +65,11 @@
package_list = PyTuple_New(0);
/* now figure out the module name from the filename */
- module_name = gplugin_python_filename_to_module(filename);
+ module_name = gplugin_python3_filename_to_module(filename); /* grab the dirname since we need it on sys.path to import the module */
dir_name = g_path_get_dirname(filename);
- gplugin_python_add_module_path(dir_name);
+ gplugin_python3_add_module_path(dir_name); @@ -169,7 +169,7 @@
info = pygobject_get(pyinfo);
/* now that we have everything, create the plugin */
- plugin = g_object_new(GPLUGIN_PYTHON_TYPE_PLUGIN,
+ plugin = g_object_new(GPLUGIN_PYTHON3_TYPE_PLUGIN, @@ -188,9 +188,9 @@
-gplugin_python_loader_load(G_GNUC_UNUSED GPluginLoader *loader,
+gplugin_python3_loader_load(G_GNUC_UNUSED GPluginLoader *loader, PyObject *load = NULL, *pyplugin = NULL, *result = NULL;
@@ -206,7 +206,7 @@
- *error = gplugin_python_exception_to_gerror();
+ *error = gplugin_python3_exception_to_gerror(); @@ -224,9 +224,9 @@
-gplugin_python_loader_unload(G_GNUC_UNUSED GPluginLoader *loader,
+gplugin_python3_loader_unload(G_GNUC_UNUSED GPluginLoader *loader, PyObject *unload = NULL, *pyplugin = NULL, *result = NULL;
@@ -258,10 +258,10 @@
/******************************************************************************
*****************************************************************************/
-gplugin_python_loader_init_pygobject(void) {
+gplugin_python3_loader_init_pygobject(void) { PyObject *type = NULL, *value = NULL, *tb = NULL, *obj = NULL;
@@ -289,7 +289,7 @@
-gplugin_python_loader_init_gettext(void) {
+gplugin_python3_loader_init_gettext(void) { PyObject *module_dict = NULL, *install = NULL;
PyObject *gettext = NULL, *result = NULL;
@@ -310,7 +310,7 @@
-gplugin_python_loader_init_python(void) {
+gplugin_python3_loader_init_python(void) { wchar_t *argv[] = { NULL, NULL };
@@ -330,8 +330,8 @@
/* initialize pygobject */
- if(gplugin_python_loader_init_pygobject()) {
- if(gplugin_python_loader_init_gettext()) {
+ if(gplugin_python3_loader_init_pygobject()) { + if(gplugin_python3_loader_init_gettext()) { @@ -340,34 +340,34 @@
/******************************************************************************
+ * GObject Implementation *****************************************************************************/
-gplugin_python_loader_init(G_GNUC_UNUSED GPluginPythonLoader *loader) {
+gplugin_python3_loader_init(G_GNUC_UNUSED GPluginPython3Loader *loader) { -gplugin_python_loader_class_finalize(G_GNUC_UNUSED GPluginPythonLoaderClass *klass)
+gplugin_python3_loader_class_finalize(G_GNUC_UNUSED GPluginPython3LoaderClass *klass) -gplugin_python_loader_class_init(GPluginPythonLoaderClass *klass) {
+gplugin_python3_loader_class_init(GPluginPython3LoaderClass *klass) { GPluginLoaderClass *loader_class = GPLUGIN_LOADER_CLASS(klass);
loader_class->supported_extensions =
- gplugin_python_loader_class_supported_extensions;
- loader_class->query = gplugin_python_loader_query;
- loader_class->load = gplugin_python_loader_load;
- loader_class->unload = gplugin_python_loader_unload;
+ gplugin_python3_loader_class_supported_extensions; + loader_class->query = gplugin_python3_loader_query; + loader_class->load = gplugin_python3_loader_load; + loader_class->unload = gplugin_python3_loader_unload; /******************************************************************************
*****************************************************************************/
-gplugin_python_loader_register(GPluginNativePlugin *native) {
- gplugin_python_loader_register_type(G_TYPE_MODULE(native));
+gplugin_python3_loader_register(GPluginNativePlugin *native) { + gplugin_python3_loader_register_type(G_TYPE_MODULE(native)); - gplugin_python_loader_init_python();
+ gplugin_python3_loader_init_python(); --- a/python/gplugin-python3-loader.h Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-loader.h Sat Feb 22 04:00:07 2020 -0600
@@ -15,19 +15,19 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
-#ifndef GPLUGIN_PYTHON_LOADER_H
-#define GPLUGIN_PYTHON_LOADER_H
+#ifndef GPLUGIN_PYTHON3_LOADER_H +#define GPLUGIN_PYTHON3_LOADER_H #include <gplugin-native.h>
-#define GPLUGIN_PYTHON_TYPE_LOADER (gplugin_python_loader_get_type())
-G_DECLARE_FINAL_TYPE(GPluginPythonLoader, gplugin_python_loader, GPLUGIN_PYTHON, LOADER, GPluginLoader)
+#define GPLUGIN_PYTHON3_TYPE_LOADER (gplugin_python3_loader_get_type()) +G_DECLARE_FINAL_TYPE(GPluginPython3Loader, gplugin_python3_loader, GPLUGIN_PYTHON3, LOADER, GPluginLoader) -void gplugin_python_loader_register(GPluginNativePlugin *native);
+void gplugin_python3_loader_register(GPluginNativePlugin *native); -#endif /* GPLUGIN_PYTHON_LOADER_H */
+#endif /* GPLUGIN_PYTHON3_LOADER_H */ --- a/python/gplugin-python3-plugin.c Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-plugin.c Sat Feb 22 04:00:07 2020 -0600
@@ -24,7 +24,7 @@
/******************************************************************************
*****************************************************************************/
-struct _GPluginPythonPlugin {
+struct _GPluginPython3Plugin { @@ -57,29 +57,29 @@
static GParamSpec *properties[N_PROPERTIES] = {NULL,};
/* I hate forward declarations... */
-static void gplugin_python_plugin_iface_init(GPluginPluginInterface *iface);
+static void gplugin_python3_plugin_iface_init(GPluginPluginInterface *iface); G_DEFINE_DYNAMIC_TYPE_EXTENDED(
+ gplugin_python3_plugin, - G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_python_plugin_iface_init)
+ G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_python3_plugin_iface_init) /******************************************************************************
* GPluginPlugin Implementation
*****************************************************************************/
-gplugin_python_plugin_iface_init(G_GNUC_UNUSED GPluginPluginInterface *iface) {
+gplugin_python3_plugin_iface_init(G_GNUC_UNUSED GPluginPluginInterface *iface) { /******************************************************************************
*****************************************************************************/
-gplugin_python_plugin_set_module(GPluginPythonPlugin *plugin,
+gplugin_python3_plugin_set_module(GPluginPython3Plugin *plugin, g_return_if_fail(GPLUGIN_IS_PLUGIN(plugin));
g_return_if_fail(module);
@@ -90,17 +90,17 @@
-gplugin_python_plugin_get_load_func(GPluginPythonPlugin *plugin) {
- g_return_val_if_fail(GPLUGIN_PYTHON_IS_PLUGIN(plugin), NULL);
+gplugin_python3_plugin_get_load_func(GPluginPython3Plugin *plugin) { + g_return_val_if_fail(GPLUGIN_PYTHON3_IS_PLUGIN(plugin), NULL); -gplugin_python_plugin_set_load_func(GPluginPythonPlugin *plugin,
+gplugin_python3_plugin_set_load_func(GPluginPython3Plugin *plugin, - g_return_if_fail(GPLUGIN_PYTHON_IS_PLUGIN(plugin));
+ g_return_if_fail(GPLUGIN_PYTHON3_IS_PLUGIN(plugin)); g_return_if_fail(func != NULL);
@@ -109,17 +109,17 @@
-gplugin_python_plugin_get_unload_func(GPluginPythonPlugin *plugin) {
- g_return_val_if_fail(GPLUGIN_PYTHON_IS_PLUGIN(plugin), NULL);
+gplugin_python3_plugin_get_unload_func(GPluginPython3Plugin *plugin) { + g_return_val_if_fail(GPLUGIN_PYTHON3_IS_PLUGIN(plugin), NULL); -gplugin_python_plugin_set_unload_func(GPluginPythonPlugin *plugin,
+gplugin_python3_plugin_set_unload_func(GPluginPython3Plugin *plugin, - g_return_if_fail(GPLUGIN_PYTHON_IS_PLUGIN(plugin));
+ g_return_if_fail(GPLUGIN_PYTHON3_IS_PLUGIN(plugin)); g_return_if_fail(func != NULL);
@@ -128,13 +128,13 @@
/******************************************************************************
+ * GObject Implementation *****************************************************************************/
-gplugin_python_plugin_get_property(GObject *obj, guint param_id, GValue *value,
+gplugin_python3_plugin_get_property(GObject *obj, guint param_id, GValue *value, - GPluginPythonPlugin *plugin = GPLUGIN_PYTHON_PLUGIN(obj);
+ GPluginPython3Plugin *plugin = GPLUGIN_PYTHON3_PLUGIN(obj); @@ -142,11 +142,11 @@
g_value_set_pointer(value,
- gplugin_python_plugin_get_load_func(plugin));
+ gplugin_python3_plugin_get_load_func(plugin)); g_value_set_pointer(value,
- gplugin_python_plugin_get_unload_func(plugin));
+ gplugin_python3_plugin_get_unload_func(plugin)); @@ -170,23 +170,23 @@
-gplugin_python_plugin_set_property(GObject *obj, guint param_id,
- const GValue *value, GParamSpec *pspec)
+gplugin_python3_plugin_set_property(GObject *obj, guint param_id, + const GValue *value, GParamSpec *pspec) - GPluginPythonPlugin *plugin = GPLUGIN_PYTHON_PLUGIN(obj);
+ GPluginPython3Plugin *plugin = GPLUGIN_PYTHON3_PLUGIN(obj); - gplugin_python_plugin_set_module(plugin,
- g_value_get_pointer(value));
+ gplugin_python3_plugin_set_module(plugin, + g_value_get_pointer(value)); - gplugin_python_plugin_set_load_func(plugin,
- g_value_get_pointer(value));
+ gplugin_python3_plugin_set_load_func(plugin, + g_value_get_pointer(value)); - gplugin_python_plugin_set_unload_func(plugin,
- g_value_get_pointer(value));
+ gplugin_python3_plugin_set_unload_func(plugin, + g_value_get_pointer(value)); @@ -210,8 +210,8 @@
-gplugin_python_plugin_finalize(GObject *obj) {
- GPluginPythonPlugin *plugin = GPLUGIN_PYTHON_PLUGIN(obj);
+gplugin_python3_plugin_finalize(GObject *obj) { + GPluginPython3Plugin *plugin = GPLUGIN_PYTHON3_PLUGIN(obj); Py_CLEAR(plugin->module);
@@ -221,25 +221,25 @@
g_clear_object(&plugin->loader);
g_clear_object(&plugin->info);
- G_OBJECT_CLASS(gplugin_python_plugin_parent_class)->finalize(obj);
+ G_OBJECT_CLASS(gplugin_python3_plugin_parent_class)->finalize(obj); -gplugin_python_plugin_init(G_GNUC_UNUSED GPluginPythonPlugin *plugin) {
+gplugin_python3_plugin_init(G_GNUC_UNUSED GPluginPython3Plugin *plugin) { -gplugin_python_plugin_class_finalize(G_GNUC_UNUSED GPluginPythonPluginClass *klass)
+gplugin_python3_plugin_class_finalize(G_GNUC_UNUSED GPluginPython3PluginClass *klass) -gplugin_python_plugin_class_init(GPluginPythonPluginClass *klass) {
+gplugin_python3_plugin_class_init(GPluginPython3PluginClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- obj_class->get_property = gplugin_python_plugin_get_property;
- obj_class->set_property = gplugin_python_plugin_set_property;
- obj_class->finalize = gplugin_python_plugin_finalize;
+ obj_class->get_property = gplugin_python3_plugin_get_property; + obj_class->set_property = gplugin_python3_plugin_set_property; + obj_class->finalize = gplugin_python3_plugin_finalize; properties[PROP_MODULE] = g_param_spec_pointer(
@@ -272,6 +272,7 @@
*****************************************************************************/
-gplugin_python_plugin_register(GPluginNativePlugin *native) {
- gplugin_python_plugin_register_type(G_TYPE_MODULE(native));
+gplugin_python3_plugin_register(GPluginNativePlugin *native) { + gplugin_python3_plugin_register_type(G_TYPE_MODULE(native)); --- a/python/gplugin-python3-plugin.h Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-plugin.h Sat Feb 22 04:00:07 2020 -0600
@@ -15,19 +15,19 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
-#ifndef GPLUGIN_PYTHON_PLUGIN_H
-#define GPLUGIN_PYTHON_PLUGIN_H
+#ifndef GPLUGIN_PYTHON3_PLUGIN_H +#define GPLUGIN_PYTHON3_PLUGIN_H #include <gplugin-native.h>
-#define GPLUGIN_PYTHON_TYPE_PLUGIN (gplugin_python_plugin_get_type())
-G_DECLARE_FINAL_TYPE(GPluginPythonPlugin, gplugin_python_plugin, GPLUGIN_PYTHON, PLUGIN, GObject)
+#define GPLUGIN_PYTHON3_TYPE_PLUGIN (gplugin_python3_plugin_get_type()) +G_DECLARE_FINAL_TYPE(GPluginPython3Plugin, gplugin_python3_plugin, GPLUGIN_PYTHON3, PLUGIN, GObject) -void gplugin_python_plugin_register(GPluginNativePlugin *native);
+void gplugin_python3_plugin_register(GPluginNativePlugin *native); -#endif /* GPLUGIN_PYTHON_PLUGIN_H */
+#endif /* GPLUGIN_PYTHON3_PLUGIN_H */ --- a/python/gplugin-python3-utils.c Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-utils.c Sat Feb 22 04:00:07 2020 -0600
@@ -24,7 +24,7 @@
-gplugin_python_filename_to_module(const gchar *filename) {
+gplugin_python3_filename_to_module(const gchar *filename) { gchar *e = NULL, *r = NULL;
@@ -51,7 +51,7 @@
-gplugin_python_add_module_path(const gchar *module_path) {
+gplugin_python3_add_module_path(const gchar *module_path) { PyObject *sys_path = NULL, *path = NULL;
@@ -70,7 +70,7 @@
-gplugin_python_exception_to_gerror(void) {
+gplugin_python3_exception_to_gerror(void) { PyObject *type = NULL, *value = NULL, *trace = NULL;
PyObject *type_name = NULL, *value_str = NULL, *obj = NULL;
--- a/python/gplugin-python3-utils.h Sat Feb 22 03:41:23 2020 -0600
+++ b/python/gplugin-python3-utils.h Sat Feb 22 04:00:07 2020 -0600
@@ -15,21 +15,21 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
-#ifndef GPLUGIN_PYTHON_UTILS_H
-#define GPLUGIN_PYTHON_UTILS_H
+#ifndef GPLUGIN_PYTHON3_UTILS_H +#define GPLUGIN_PYTHON3_UTILS_H -#define GPLUGIN_PYTHON_DOMAIN (g_quark_from_static_string("gplugin-python"))
+#define GPLUGIN_PYTHON3_DOMAIN (g_quark_from_static_string("gplugin-python")) -gchar *gplugin_python_filename_to_module(const gchar *filename);
+gchar *gplugin_python3_filename_to_module(const gchar *filename); -gboolean gplugin_python_add_module_path(const gchar *module_path);
+gboolean gplugin_python3_add_module_path(const gchar *module_path); -GError *gplugin_python_exception_to_gerror(void);
+GError *gplugin_python3_exception_to_gerror(void); -#endif /* GPLUGIN_PYTHON_UTILS_H */
+#endif /* GPLUGIN_PYTHON3_UTILS_H */ --- a/python/tests/test-python3-utils.c Sat Feb 22 03:41:23 2020 -0600
+++ b/python/tests/test-python3-utils.c Sat Feb 22 04:00:07 2020 -0600
@@ -26,7 +26,7 @@
*****************************************************************************/
test_filename_to_module_NULL_subprocess(void) {
- gplugin_python_filename_to_module(NULL);
+ gplugin_python3_filename_to_module(NULL); @@ -38,7 +38,7 @@
test_filename_to_module_empty(void) {
- gchar *module = gplugin_python_filename_to_module("");
+ gchar *module = gplugin_python3_filename_to_module(""); g_assert_cmpstr(module, ==, "");
@@ -47,7 +47,7 @@
test_filename_to_module_no_extension(void) {
- gchar *module = gplugin_python_filename_to_module("foo");
+ gchar *module = gplugin_python3_filename_to_module("foo"); g_assert_cmpstr(module, ==, "foo");