Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

changeset 3034
7ce719013078
parent 3022
57179e4cdadd
child 3036
30c81c9e88b8
equal deleted inserted replaced
3033:58fe260e7469 3034:7ce719013078
150 for ext in Preferences.getPython("PythonExtensions"): 150 for ext in Preferences.getPython("PythonExtensions"):
151 files.extend( 151 files.extend(
152 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) 152 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0))
153 else: 153 else:
154 files = [fn] 154 files = [fn]
155 py3files = [f for f in files \ 155 py3files = [f for f in files
156 if f.endswith( 156 if f.endswith(
157 tuple(Preferences.getPython("Python3Extensions")))] 157 tuple(Preferences.getPython("Python3Extensions")))]
158 py2files = [f for f in files \ 158 py2files = [f for f in files
159 if f.endswith( 159 if f.endswith(
160 tuple(Preferences.getPython("PythonExtensions")))] 160 tuple(Preferences.getPython("PythonExtensions")))]
161 161
162 if (codestring and len(py3files) == 1) or \ 162 if (codestring and len(py3files) == 1) or \
163 (codestring and len(py2files) == 1) or \ 163 (codestring and len(py2files) == 1) or \
189 source = Utilities.convertLineEnds(source, "\n") 189 source = Utilities.convertLineEnds(source, "\n")
190 except (UnicodeError, IOError) as msg: 190 except (UnicodeError, IOError) as msg:
191 self.noResults = False 191 self.noResults = False
192 self.__createResultItem( 192 self.__createResultItem(
193 file, "1", 0, 193 file, "1", 0,
194 self.trUtf8("Error: {0}").format(str(msg))\ 194 self.trUtf8("Error: {0}").format(str(msg))
195 .rstrip()[1:-1], "") 195 .rstrip()[1:-1], "")
196 progress += 1 196 progress += 1
197 continue 197 continue
198 198
199 flags = Utilities.extractFlags(source) 199 flags = Utilities.extractFlags(source)
200 ext = os.path.splitext(file)[1] 200 ext = os.path.splitext(file)[1]
201 if ("FileType" in flags and 201 if ("FileType" in flags and
202 flags["FileType"] in ["Python", "Python2"]) or \ 202 flags["FileType"] in ["Python", "Python2"]) or \
203 file in py2files or \ 203 file in py2files or \
204 (ext in [".py", ".pyw"] and \ 204 (ext in [".py", ".pyw"] and
205 Preferences.getProject("DeterminePyFromProject") and \ 205 Preferences.getProject("DeterminePyFromProject") and
206 self.__project.isOpen() and \ 206 self.__project.isOpen() and
207 self.__project.isProjectFile(file) and \ 207 self.__project.isProjectFile(file) and
208 self.__project.getProjectLanguage() in ["Python", 208 self.__project.getProjectLanguage() in ["Python",
209 "Python2"]): 209 "Python2"]):
210 isPy3 = False 210 isPy3 = False
211 nok, fname, line, index, code, error, warnings = \ 211 nok, fname, line, index, code, error, warnings = \
212 Utilities.py2compile( 212 Utilities.py2compile(

eric ide

mercurial