##// END OF EJS Templates
changed so that paths are ignored when they startWith() an ignore path instead of matching the ignore path...
florianlink -
r40:054959ca17a1
parent child
Show More
@@ -113,33 +113,29 PythonQtImport::module_info PythonQtImport::getModuleInfo(PythonQtImporter* self
113
113
114
114
115 /* PythonQtImporter.__init__
115 /* PythonQtImporter.__init__
116 Just store the path argument
116 Just store the path argument (or reject if it is in the ignorePaths list
117 */
117 */
118 int PythonQtImporter_init(PythonQtImporter *self, PyObject *args, PyObject * /*kwds*/)
118 int PythonQtImporter_init(PythonQtImporter *self, PyObject *args, PyObject * /*kwds*/)
119 {
119 {
120 self->_path = NULL;
120 self->_path = NULL;
121
121
122 const char* path;
122 const char* cpath;
123 if (!PyArg_ParseTuple(args, "s",
123 if (!PyArg_ParseTuple(args, "s",
124 &path))
124 &cpath))
125 return -1;
125 return -1;
126
126
127 QString path(cpath);
127 if (PythonQt::importInterface()->exists(path)) {
128 if (PythonQt::importInterface()->exists(path)) {
128 //qDebug("path %s", path);
129 QString p(path);
130 const QStringList& ignorePaths = PythonQt::self()->getImporterIgnorePaths();
129 const QStringList& ignorePaths = PythonQt::self()->getImporterIgnorePaths();
131 foreach(QString a, ignorePaths) {
130 foreach(QString ignorePath, ignorePaths) {
132 if (a==p) {
131 if (path.startsWith(ignorePath)) {
133 PyErr_SetString(PythonQtImportError,
132 PyErr_SetString(PythonQtImportError,
134 "path ignored");
133 "path ignored");
135 return -1;
134 return -1;
136 }
135 }
137 }
136 }
138
137
139 self->_path = new QString(p);
138 self->_path = new QString(path);
140
141 //mlabDebugConst("MLABPython", "PythonQtImporter init: " << *self->_path);
142
143 return 0;
139 return 0;
144 } else {
140 } else {
145 PyErr_SetString(PythonQtImportError,
141 PyErr_SetString(PythonQtImportError,
General Comments 0
You need to be logged in to leave comments. Login now