diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-03-22 13:17:44 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-03-22 13:17:44 -0300 |
commit | c890a5590d0e5ac9eaf2b7a173c827f2ca10e3be (patch) | |
tree | 10999f05975c8be90466e98850954bf4e7f1e24e /src/main.cpp | |
parent | 2732de4495fd7dc9232b2ea21fc2ad019802ae71 (diff) |
First draft of the launcher
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..237b282 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,38 @@ +#include <iostream> +#include <vector> +#include <string> + +#include <boost/python.hpp> +#include <frameobject.h> + +using namespace boost::python; + +int +main(int argc, char** argv) +{ + try { + Py_Initialize(); + object main_module = import("__main__"); + object global = (main_module.attr("__dict__")); + + PySys_SetArgv(argc, argv); + + exec( + "import os\n" + "import sys\n" + "import encodings.idna\n" // we need to make sure this is imported + "sys.path = [os.path.join(os.getcwd(), 'deps'),\n" + " os.path.join(os.getcwd(), 'apps'),\n" + " os.path.join(os.getcwd(), 'apps', 'eip'),\n" + " os.getcwd()]\n" + "sys.argv.append('--standalone')\n", global, global); + + exec_file("apps/leap/app.py", + global, + global); + } catch (error_already_set&) { + PyErr_PrintEx(0); + return 1; + } + return 0; +} |