145 if isinstance(fn, list): |
145 if isinstance(fn, list): |
146 files = fn |
146 files = fn |
147 elif os.path.isdir(fn): |
147 elif os.path.isdir(fn): |
148 files = [] |
148 files = [] |
149 extensions = set(Preferences.getPython("PythonExtensions") + |
149 extensions = set(Preferences.getPython("PythonExtensions") + |
150 Preferences.getPython("Python3Extensions")) |
150 Preferences.getPython("Python3Extensions")) |
151 for ext in extensions: |
151 for ext in extensions: |
152 files.extend( |
152 files.extend( |
153 Utilities.direntries(fn, True, '*{0}'.format(ext), 0)) |
153 Utilities.direntries(fn, True, '*{0}'.format(ext), 0)) |
154 else: |
154 else: |
155 files = [fn] |
155 files = [fn] |
187 |
187 |
188 flags = Utilities.extractFlags(source) |
188 flags = Utilities.extractFlags(source) |
189 ext = os.path.splitext(file)[1] |
189 ext = os.path.splitext(file)[1] |
190 if "FileType" in flags: |
190 if "FileType" in flags: |
191 isPy2 = flags["FileType"] in ["Python", "Python2"] |
191 isPy2 = flags["FileType"] in ["Python", "Python2"] |
192 elif (Preferences.getProject("DeterminePyFromProject") and \ |
192 elif (Preferences.getProject("DeterminePyFromProject") and |
193 self.__project.isOpen() and |
193 self.__project.isOpen() and |
194 self.__project.isProjectFile(file)): |
194 self.__project.isProjectFile(file)): |
195 isPy2 = self.__project.getProjectLanguage() in \ |
195 isPy2 = self.__project.getProjectLanguage() in \ |
196 ["Python", "Python2"] |
196 ["Python", "Python2"] |
197 else: |
197 else: |
198 isPy2 = flags.get("FileType") in ["Python", "Python2"] or \ |
198 isPy2 = flags.get("FileType") in ["Python", "Python2"] or \ |
199 ext in Preferences.getPython("PythonExtensions") |
199 ext in Preferences.getPython("PythonExtensions") |
200 |
200 |
201 nok, fname, line, index, code, error, warnings = \ |
201 nok, fname, line, index, code, error, warnings = \ |
202 Utilities.compile(file, source, isPy2) |
202 Utilities.compile(file, source, isPy2) |
203 if nok: |
203 if nok: |
204 self.noResults = False |
204 self.noResults = False |
205 self.__createResultItem(fname, line, index, error, code.strip(), False) |
205 self.__createResultItem( |
|
206 fname, line, index, error, code.strip(), False) |
206 else: |
207 else: |
207 source = source.splitlines() |
208 source = source.splitlines() |
208 for warning in warnings: |
209 for warning in warnings: |
209 self.noResults = False |
210 self.noResults = False |
210 scr_line = source[warning[2]-1].strip() |
211 scr_line = source[warning[2] - 1].strip() |
211 self.__createResultItem( |
212 self.__createResultItem( |
212 warning[1], warning[2], 0, |
213 warning[1], warning[2], 0, |
213 warning[3], scr_line, True) |
214 warning[3], scr_line, True) |
214 |
215 |
215 progress += 1 |
216 progress += 1 |
216 self.checkProgress.setValue(progress) |
217 self.checkProgress.setValue(progress) |
217 QApplication.processEvents() |
218 QApplication.processEvents() |
218 self.__resort() |
219 self.__resort() |