From: Benedikt Tutzer Date: Mon, 20 Aug 2018 13:27:50 +0000 (+0200) Subject: The share directory cannot be searched when used as a Python library, only in shell... X-Git-Tag: yosys-0.9~179^2~40 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d41c68ee5ad908db1dd75552816789e493d011bf;p=yosys.git The share directory cannot be searched when used as a Python library, only in shell mode --- diff --git a/kernel/driver.cc b/kernel/driver.cc index 178641101..255fe45c4 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -110,6 +110,10 @@ int main(int argc, char **argv) log_error_stderr = true; yosys_banner(); yosys_setup(); +#ifdef WITH_PYTHON + PyRun_SimpleString(("sys.path.append(\""+proc_self_dirname()+"\")").c_str()); + PyRun_SimpleString(("sys.path.append(\""+proc_share_dirname()+"plugins\")").c_str()); +#endif if (argc == 2) { @@ -462,6 +466,10 @@ int main(int argc, char **argv) #endif yosys_setup(); +#ifdef WITH_PYTHON + PyRun_SimpleString(("sys.path.append(\""+proc_self_dirname()+"\")").c_str()); + PyRun_SimpleString(("sys.path.append(\""+proc_share_dirname()+"plugins\")").c_str()); +#endif log_error_atexit = yosys_atexit; for (auto &fn : plugin_filenames) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index e36c68752..a6d09c077 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -495,7 +495,6 @@ void yosys_setup() PyImport_AppendInittab((char*)"libyosys", INIT_MODULE); Py_Initialize(); PyRun_SimpleString("import sys"); - PyRun_SimpleString(("sys.path.append(\""+proc_share_dirname()+"plugins\")").c_str()); #endif Pass::init_register();