From bafb4702c7176a08e4a9b2088297071a7bed6656 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 Jun 2018 11:45:19 +0200 Subject: reinit python tab --- dummy/main.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'dummy') diff --git a/dummy/main.cc b/dummy/main.cc index de578ca3..d025d8d4 100644 --- a/dummy/main.cc +++ b/dummy/main.cc @@ -92,11 +92,6 @@ int main(int argc, char *argv[]) Context ctx(ArchArgs{}); -#ifndef NO_PYTHON - init_python(argv[0]); - python_export_global("ctx", ctx); -#endif - if (vm.count("verbose")) { ctx.verbose = true; } @@ -111,9 +106,14 @@ int main(int argc, char *argv[]) #ifndef NO_PYTHON if (vm.count("run")) { + init_python(argv[0], true); + python_export_global("ctx", ctx); + std::vector files = vm["run"].as>(); for (auto filename : files) execute_python_file(filename.c_str()); + + deinit_python(); } #endif @@ -125,9 +125,6 @@ int main(int argc, char *argv[]) rc = a.exec(); } -#endif -#ifndef NO_PYTHON - deinit_python(); #endif return rc; } catch (log_execution_error_exception) { -- cgit v1.2.3