diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 16a2a2a7..850be61c 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -6463,7 +6463,7 @@ gboolean cmd_plugins_python_version(ProfWin *window, const char *const command, gchar **args) { #ifdef HAVE_PYTHON - const char *version = python_get_version(); + const char *version = python_get_version_string(); cons_show("Python version:"); cons_show("%s", version); #else diff --git a/src/main.c b/src/main.c index a473ac42..3910c47a 100644 --- a/src/main.c +++ b/src/main.c @@ -41,6 +41,10 @@ #include "gitversion.h" #endif +#ifdef HAVE_PYTHON +#include "plugins/python_plugins.h" +#endif + #include "profanity.h" #include "common.h" #include "command/cmd_defs.h" @@ -131,7 +135,9 @@ main(int argc, char **argv) #endif #ifdef HAVE_PYTHON - g_print("Python plugins: Enabled\n"); + gchar *python_version = python_get_version_number(); + g_print("Python plugins: Enabled (%s)\n", python_version); + g_free(python_version); #else g_print("Python plugins: Disabled\n"); #endif diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c index f8f35628..934a2e4f 100644 --- a/src/plugins/python_plugins.c +++ b/src/plugins/python_plugins.c @@ -74,11 +74,22 @@ _unref_module(PyObject *module) } const char* -python_get_version(void) +python_get_version_string(void) { return Py_GetVersion(); } +gchar* +python_get_version_number(void) +{ + const char *version_str = Py_GetVersion(); + gchar **split = g_strsplit(version_str, " ", 0); + gchar *version_number = g_strdup(split[0]); + g_strfreev(split); + + return version_number; +} + void python_env_init(void) { diff --git a/src/plugins/python_plugins.h b/src/plugins/python_plugins.h index 778846b2..4b76ce4c 100644 --- a/src/plugins/python_plugins.h +++ b/src/plugins/python_plugins.h @@ -43,7 +43,8 @@ void python_check_error(void); void allow_python_threads(); void disable_python_threads(); -const char* python_get_version(void); +const char* python_get_version_string(void); +gchar* python_get_version_number(void); void python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status, const char *const account_name, const char *const fulljid);