aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-27 12:00:37 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-27 12:00:37 +0200
commit87a5b7212667daa55a72f62c35cc248bdce2c744 (patch)
treecd541aeba55bbc67e1a935bb00b7669a9eed0d32 /common
parent2cc7ade05b52b89186f5210c97ebbc61aa5c166d (diff)
parentbafb4702c7176a08e4a9b2088297071a7bed6656 (diff)
downloadnextpnr-87a5b7212667daa55a72f62c35cc248bdce2c744.tar.gz
nextpnr-87a5b7212667daa55a72f62c35cc248bdce2c744.tar.bz2
nextpnr-87a5b7212667daa55a72f62c35cc248bdce2c744.zip
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'common')
-rw-r--r--common/pybindings.cc14
-rw-r--r--common/pybindings.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/common/pybindings.cc b/common/pybindings.cc
index 13e0976c..02c39fa3 100644
--- a/common/pybindings.cc
+++ b/common/pybindings.cc
@@ -127,11 +127,9 @@ BOOST_PYTHON_MODULE(MODULE_NAME)
class_<Context, Context *, bases<Arch>, boost::noncopyable>("Context", no_init).def("checksum", &Context::checksum);
}
-void arch_appendinittab() { PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME); }
-
static wchar_t *program;
-void init_python(const char *executable)
+void init_python(const char *executable,bool first)
{
#ifdef MAIN_EXECUTABLE
program = Py_DecodeLocale(executable, NULL);
@@ -140,11 +138,15 @@ void init_python(const char *executable)
exit(1);
}
try {
- PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME);
- emb::append_inittab();
+ if (first)
+ {
+ PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME);
+ emb::append_inittab();
+ }
Py_SetProgramName(program);
Py_Initialize();
- PyImport_ImportModule(TOSTRING(MODULE_NAME));
+ if (first)
+ PyImport_ImportModule(TOSTRING(MODULE_NAME));
} catch (boost::python::error_already_set const &) {
// Parse and output the exception
std::string perror_str = parse_python_exception();
diff --git a/common/pybindings.h b/common/pybindings.h
index 1f5ca004..4180c2e9 100644
--- a/common/pybindings.h
+++ b/common/pybindings.h
@@ -100,14 +100,12 @@ template <typename Tn> void python_export_global(const char *name, Tn &x)
}
};
-void init_python(const char *executable);
+void init_python(const char *executable, bool first);
void deinit_python();
void execute_python_file(const char *python_file);
-void arch_appendinittab();
-
NEXTPNR_NAMESPACE_END
#endif /* end of include guard: COMMON_PYBINDINGS_HH */