5 |
5 |
6 """ |
6 """ |
7 Module implementing the PyLint plug-in. |
7 Module implementing the PyLint plug-in. |
8 """ |
8 """ |
9 |
9 |
|
10 import contextlib |
|
11 import copy |
|
12 import os |
|
13 import platform |
10 import re |
14 import re |
11 import os |
15 |
12 import copy |
16 from PyQt6.QtCore import QCoreApplication, QObject, QProcess, QTranslator |
13 import platform |
|
14 import contextlib |
|
15 |
|
16 from PyQt6.QtCore import QObject, QTranslator, QCoreApplication, QProcess |
|
17 from PyQt6.QtWidgets import QDialog |
17 from PyQt6.QtWidgets import QDialog |
18 |
18 |
19 from eric7 import Preferences, Utilities |
19 from eric7 import Preferences |
20 from eric7.EricGui.EricAction import EricAction |
20 from eric7.EricGui.EricAction import EricAction |
21 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem |
23 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem |
|
24 |
|
25 try: |
|
26 from eric7.SystemUtilities.OSUtilities import getEnvironmentEntry, isWindowsPlatform |
|
27 except ImportError: |
|
28 # imports for eric < 23.1 |
|
29 from eric7.Utilities import getEnvironmentEntry, isWindowsPlatform |
24 |
30 |
25 # Start-of-Header |
31 # Start-of-Header |
26 name = "PyLint Plugin" |
32 name = "PyLint Plugin" |
27 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
33 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
28 autoactivate = True |
34 autoactivate = True |
29 deactivateable = True |
35 deactivateable = True |
30 version = "10.1.1" |
36 version = "10.2.0" |
31 className = "PyLintPlugin" |
37 className = "PyLintPlugin" |
32 packageName = "PyLintInterface" |
38 packageName = "PyLintInterface" |
33 shortDescription = "Show the PyLint dialogs." |
39 shortDescription = "Show the PyLint dialogs." |
34 longDescription = ( |
40 longDescription = ( |
35 """This plug-in implements the PyLint dialogs. PyLint is used to check""" |
41 """This plug-in implements the PyLint dialogs. PyLint is used to check""" |
187 executables.add(exePath) |
193 executables.add(exePath) |
188 |
194 |
189 if not executables and majorVersion >= 3: |
195 if not executables and majorVersion >= 3: |
190 # check the PATH environment variable if nothing was found |
196 # check the PATH environment variable if nothing was found |
191 # Python 3 only |
197 # Python 3 only |
192 path = Utilities.getEnvironmentEntry("PATH") |
198 path = getEnvironmentEntry("PATH") |
193 if path: |
199 if path: |
194 dirs = path.split(os.pathsep) |
200 dirs = path.split(os.pathsep) |
195 for directory in dirs: |
201 for directory in dirs: |
196 for suffix in (".bat", ".exe"): |
202 for suffix in (".bat", ".exe"): |
197 exe = os.path.join(directory, "pylint" + suffix) |
203 exe = os.path.join(directory, "pylint" + suffix) |
208 ] |
214 ] |
209 for minorVersion in minorVersions: |
215 for minorVersion in minorVersions: |
210 scriptSuffixes.append("-python{0}.{1}".format(majorVersion, minorVersion)) |
216 scriptSuffixes.append("-python{0}.{1}".format(majorVersion, minorVersion)) |
211 # There could be multiple pylint executables in the path |
217 # There could be multiple pylint executables in the path |
212 # e.g. for different python variants |
218 # e.g. for different python variants |
213 path = Utilities.getEnvironmentEntry("PATH") |
219 path = getEnvironmentEntry("PATH") |
214 # environment variable not defined |
220 # environment variable not defined |
215 if path is None: |
221 if path is None: |
216 return [] |
222 return [] |
217 |
223 |
218 # step 1: determine possible candidates |
224 # step 1: determine possible candidates |