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 --- ice40/main.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'ice40/main.cc') diff --git a/ice40/main.cc b/ice40/main.cc index ecaba87f..f1736fab 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -269,11 +269,6 @@ int main(int argc, char *argv[]) Context ctx(chipArgs); -#ifndef NO_PYTHON - init_python(argv[0]); - python_export_global("ctx", ctx); -#endif - if (vm.count("verbose")) { ctx.verbose = true; } @@ -390,9 +385,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 @@ -405,10 +405,6 @@ int main(int argc, char *argv[]) rc = a.exec(); } #endif - -#ifndef NO_PYTHON - deinit_python(); -#endif return rc; } catch (log_execution_error_exception) { #if defined(_MSC_VER) -- cgit v1.2.3