[beast: 5/14] BEAST: initialize and finalize python in main()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 5/14] BEAST: initialize and finalize python in main()
- Date: Sat, 19 Mar 2016 13:13:01 +0000 (UTC)
commit f3f8cea40fe0b86437cba4972f2074893cf5b94b
Author: Tim Janik <timj gnu org>
Date: Sat Dec 5 11:08:17 2015 +0100
BEAST: initialize and finalize python in main()
Signed-off-by: Tim Janik <timj gnu org>
beast-gtk/Makefile.am | 2 ++
beast-gtk/bstmain.cc | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/beast-gtk/Makefile.am b/beast-gtk/Makefile.am
index 28f9110..dfc8651 100644
--- a/beast-gtk/Makefile.am
+++ b/beast-gtk/Makefile.am
@@ -7,6 +7,8 @@ AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(srcdir) -I.
DEFS += @DEFINE__FILE_DIR__@ -DG_LOG_DOMAIN="\"BEAST\""
AM_CXXFLAGS += $(BEAST_CFLAGS) $(GXK_CFLAGS) $(BSE_CFLAGS) $(RAPICORN_CFLAGS) -DRAPICORN_CONVENIENCE \
-DG_DISABLE_CONST_RETURNS -DGTK_ENABLE_BROKEN # -DGTK_DISABLE_DEPRECATED
-DGTK_DISABLE_COMPAT_H
+AM_CPPFLAGS += $(PYTHON_CPPFLAGS)
+AM_LDFLAGS += $(PYTHON_LDFLAGS)
# special profiling hooks
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index be7b71c..745400a 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -12,6 +12,7 @@
#include "bstpreferences.hh"
#include "data/beast-images.h"
#include "../configure.h"
+#include <Python.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
@@ -94,6 +95,10 @@ main (int argc, char *argv[])
srand48 (tv.tv_usec + (tv.tv_sec << 16));
srand (tv.tv_usec + (tv.tv_sec << 16));
+ // setup Python
+ Py_SetProgramName (argv[0]);
+ Py_Initialize();
+
// initialize threading and GLib types
Rapicorn::ThreadInfo::self().name ("Beast GUI");
Bse::TaskRegistry::add (Rapicorn::ThreadInfo::self().name(), Rapicorn::ThisThread::process_pid(),
Rapicorn::ThisThread::thread_pid());
@@ -518,6 +523,9 @@ main_cleanup ()
GDK_THREADS_LEAVE ();
}
+ // Python cleanup
+ Py_Finalize();
+
// misc cleanups
bse_object_debug_leaks ();
Bse::TaskRegistry::remove (Rapicorn::ThisThread::thread_pid());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]