The share directory cannot be searched when used as a Python library, only in shell...
authorBenedikt Tutzer <e1225461@student.tuwien.ac.at>
Mon, 20 Aug 2018 13:27:50 +0000 (15:27 +0200)
committerBenedikt Tutzer <e1225461@student.tuwien.ac.at>
Mon, 20 Aug 2018 13:27:50 +0000 (15:27 +0200)
kernel/driver.cc
kernel/yosys.cc

index 1786411019708fe8d78b0bb91140766bc1b37f07..255fe45c4455ca4720e75363dea231afa37eb794 100644 (file)
@@ -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)
index e36c68752e2c99b03cdfe1fd20894d52f92a7ab8..a6d09c077405d9943cd0eaebddd82d1dd558be80 100644 (file)
@@ -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();