PluginPyLint.py

changeset 89
8acd446fb6e6
parent 87
e0f8b96f4195
child 91
9dc14465123e
equal deleted inserted replaced
88:db1f004f14ca 89:8acd446fb6e6
27 # Start-of-Header 27 # Start-of-Header
28 name = "PyLint Plugin" 28 name = "PyLint Plugin"
29 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 29 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
30 autoactivate = True 30 autoactivate = True
31 deactivateable = True 31 deactivateable = True
32 version = "7.1.0" 32 version = "7.1.1"
33 className = "PyLintPlugin" 33 className = "PyLintPlugin"
34 packageName = "PyLint" 34 packageName = "PyLint"
35 shortDescription = "Show the PyLint dialogs." 35 shortDescription = "Show the PyLint dialogs."
36 longDescription = ( 36 longDescription = (
37 """This plug-in implements the PyLint dialogs. PyLint is used to check""" 37 """This plug-in implements the PyLint dialogs. PyLint is used to check"""
217 217
218 # step 2: determine the Python variant 218 # step 2: determine the Python variant
219 _exePy3 = set() 219 _exePy3 = set()
220 versionArgs = ["-c", "import sys; print(sys.version_info[0])"] 220 versionArgs = ["-c", "import sys; print(sys.version_info[0])"]
221 for exe in exes: 221 for exe in exes:
222 try: 222 with open(exe, "r") as f:
223 f = open(exe, "r")
224 line0 = f.readline() 223 line0 = f.readline()
225 program = line0.replace("#!", "").strip() 224 program = line0.replace("#!", "").strip()
226 process = QProcess() 225 process = QProcess()
227 process.start(program, versionArgs) 226 process.start(program, versionArgs)
228 process.waitForFinished(5000) 227 process.waitForFinished(5000)
229 # get a QByteArray of the output 228 # get a QByteArray of the output
230 versionBytes = process.readAllStandardOutput() 229 versionBytes = process.readAllStandardOutput()
231 versionStr = str(versionBytes, encoding='utf-8').strip() 230 versionStr = str(versionBytes, encoding='utf-8').strip()
232 if versionStr == "3": 231 if versionStr == "3":
233 _exePy3.add(exe) 232 _exePy3.add(exe)
234 finally:
235 f.close()
236 233
237 executables = _exePy3 234 executables = _exePy3
238 235
239 # Find the executable with the highest version number 236 # Find the executable with the highest version number
240 maxVersion = '0.0.0' 237 maxVersion = '0.0.0'

eric ide

mercurial