From 2f871bc7068d6c87a7d950ae044ba66b0b8dcd3f Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Fri, 17 Jul 2015 12:05:46 +0200 Subject: Remove config text file loading for plugins --- src/PluginAlgorithm.cpp | 72 ++++--------------------------------------------- 1 file changed, 5 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/PluginAlgorithm.cpp b/src/PluginAlgorithm.cpp index 7dcaf68..8ba6631 100644 --- a/src/PluginAlgorithm.cpp +++ b/src/PluginAlgorithm.cpp @@ -67,79 +67,19 @@ void CPluginAlgorithm::run(int _iNrIterations){ Py_DECREF(retVal); } -const char ps = -#ifdef _WIN32 - '\\'; -#else - '/'; -#endif - -std::vector CPluginAlgorithmFactory::getPluginPathList(){ - std::vector list; - list.push_back("/etc/astra-toolbox"); - PyObject *ret, *retb; - ret = PyObject_CallMethod(inspect,"getfile","O",astra); - if(ret!=NULL){ - retb = PyObject_CallMethod(six,"b","O",ret); - Py_DECREF(ret); - if(retb!=NULL){ - std::string astra_inst (PyBytes_AsString(retb)); - Py_DECREF(retb); - ret = PyObject_CallMethod(ospath,"dirname","s",astra_inst.c_str()); - if(ret!=NULL){ - retb = PyObject_CallMethod(six,"b","O",ret); - Py_DECREF(ret); - if(retb!=NULL){ - list.push_back(std::string(PyBytes_AsString(retb))); - Py_DECREF(retb); - } - } - } - } - ret = PyObject_CallMethod(ospath,"expanduser","s","~"); - if(ret!=NULL){ - retb = PyObject_CallMethod(six,"b","O",ret); - Py_DECREF(ret); - if(retb!=NULL){ - list.push_back(std::string(PyBytes_AsString(retb)) + ps + ".astra-toolbox"); - Py_DECREF(retb); - } - } - const char *envval = getenv("ASTRA_PLUGIN_PATH"); - if(envval!=NULL){ - list.push_back(std::string(envval)); - } - return list; -} - CPluginAlgorithmFactory::CPluginAlgorithmFactory(){ Py_Initialize(); pluginDict = PyDict_New(); - ospath = PyImport_ImportModule("os.path"); inspect = PyImport_ImportModule("inspect"); six = PyImport_ImportModule("six"); - astra = PyImport_ImportModule("astra"); - std::vector fls = getPluginPathList(); - std::vector items; - for(unsigned int i=0;i