From 2f11bd5ab90436bf148428aebecca461cb5d095b Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 16 Oct 2023 23:55:06 +0200 Subject: Do not ask Python GI to look for GTK in batch mode. --- plugins/pychrysalide/core.c | 13 ++++++++++--- plugins/python/scripting/core.py | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/pychrysalide/core.c b/plugins/pychrysalide/core.c index 597ad81..5da1447 100644 --- a/plugins/pychrysalide/core.c +++ b/plugins/pychrysalide/core.c @@ -64,8 +64,10 @@ #include "debug/module.h" #include "format/module.h" #include "glibext/module.h" -#include "gtkext/module.h" -#include "gui/module.h" +#ifdef INCLUDE_GTK_SUPPORT +# include "gtkext/module.h" +# include "gui/module.h" +#endif #include "mangling/module.h" #include "plugins/module.h" #include "plugins/plugin.h" @@ -101,7 +103,9 @@ static bool is_current_abi_suitable(void); static bool install_metaclass_for_python_gobjects(void); /* Définit la version attendue de GTK à charger dans Python. */ +#ifdef INCLUDE_GTK_SUPPORT static bool set_version_for_gtk_namespace(const char *); +#endif /* Point de sortie pour l'initialisation de Python. */ static void PyExit_pychrysalide(void); @@ -423,7 +427,7 @@ static bool install_metaclass_for_python_gobjects(void) * Remarques : - * * * ******************************************************************************/ - +#ifdef INCLUDE_GTK_SUPPORT static bool set_version_for_gtk_namespace(const char *version) { bool result; /* Bilan à retourner */ @@ -459,6 +463,7 @@ static bool set_version_for_gtk_namespace(const char *version) return result; } +#endif /****************************************************************************** @@ -584,8 +589,10 @@ PyMODINIT_FUNC PyInit_pychrysalide(void) if (!install_metaclass_for_python_gobjects()) goto exit; +#ifdef INCLUDE_GTK_SUPPORT if (!set_version_for_gtk_namespace("3.0")) goto exit; +#endif if (!load_all_core_components(true)) { diff --git a/plugins/python/scripting/core.py b/plugins/python/scripting/core.py index ff912ed..135edb4 100644 --- a/plugins/python/scripting/core.py +++ b/plugins/python/scripting/core.py @@ -1,4 +1,7 @@ +import gi +gi.require_version('Gtk', '3.0') + from gi.repository import GLib, Gtk import os -- cgit v0.11.2-87-g4458