aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/main.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-06-27 11:45:19 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-06-27 11:45:19 +0200
commitbafb4702c7176a08e4a9b2088297071a7bed6656 (patch)
treea59132f64cba845f2b65c02441229fa26a00aa9e /ice40/main.cc
parent9bb489936078980e98fc873845b2ca64ddb490fb (diff)
downloadnextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.tar.gz
nextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.tar.bz2
nextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.zip
reinit python tab
Diffstat (limited to 'ice40/main.cc')
-rw-r--r--ice40/main.cc14
1 files changed, 5 insertions, 9 deletions
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<std::string> files = vm["run"].as<std::vector<std::string>>();
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)