50 self.counters = {} |
50 self.counters = {} |
51 |
51 |
52 interpreter = Preferences.getDebugger("PythonInterpreter") |
52 interpreter = Preferences.getDebugger("PythonInterpreter") |
53 if interpreter == "" or not Utilities.isExecutable(interpreter): |
53 if interpreter == "" or not Utilities.isExecutable(interpreter): |
54 self.errors.append( |
54 self.errors.append( |
55 (filename, 1, 1, |
55 (filename, 1, 1, QCoreApplication.translate( |
56 QCoreApplication.translate( |
|
57 "CodeStyleCheckerPy2", |
56 "CodeStyleCheckerPy2", |
58 "Python2 interpreter not configured."))) |
57 "Python2 interpreter not configured."))) |
59 return |
58 return |
60 |
59 |
61 checker = os.path.join(getConfig('ericDir'), |
60 checker = os.path.join(getConfig('ericDir'), |
84 proc.start(interpreter, args) |
83 proc.start(interpreter, args) |
85 finished = proc.waitForFinished(15000) |
84 finished = proc.waitForFinished(15000) |
86 if finished: |
85 if finished: |
87 output = \ |
86 output = \ |
88 str(proc.readAllStandardOutput(), |
87 str(proc.readAllStandardOutput(), |
89 Preferences.getSystem("IOEncoding"), |
88 Preferences.getSystem("IOEncoding"), |
90 'replace').splitlines() |
89 'replace').splitlines() |
91 if output[0] == "ERROR": |
90 if output[0] == "ERROR": |
92 self.errors.append((filename, 1, 1, output[2])) |
91 self.errors.append((filename, 1, 1, output[2])) |
93 return |
92 return |
94 |
93 |
95 if output[0] == "NO_PEP8": |
94 if output[0] == "NO_PEP8": |
124 code, countStr = output[index].split(None, 1) |
123 code, countStr = output[index].split(None, 1) |
125 self.counters[code] = int(countStr) |
124 self.counters[code] = int(countStr) |
126 index += 1 |
125 index += 1 |
127 else: |
126 else: |
128 self.errors.append( |
127 self.errors.append( |
129 (filename, 1, 1, |
128 (filename, 1, 1, QCoreApplication.translate( |
130 QCoreApplication.translate( |
|
131 "CodeStyleCheckerPy2", |
129 "CodeStyleCheckerPy2", |
132 "Python2 interpreter did not finish within 15s."))) |
130 "Python2 interpreter did not finish within 15s."))) |