~ubuntu-branches/ubuntu/wily/spyder/wily

« back to all changes in this revision

Viewing changes to debian/patches/backport-pylint3-support.patch

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2015-01-15 12:20:11 UTC
  • mfrom: (18.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150115122011-cc7j5dhy2h9uo13m
Tags: 2.3.2+dfsg-1ubuntu1
Backport patch to support pylint3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Call pylint3 instead of pylint on Python 3
 
2
Author: Benjamin Drung <benjamin.drung@profitbricks.com>
 
3
Forwarded: yes, https://bitbucket.org/spyder-ide/spyderlib/pull-request/91
 
4
 
 
5
--- a/spyderplugins/widgets/pylintgui.py
 
6
+++ b/spyderplugins/widgets/pylintgui.py
 
7
@@ -36,11 +36,15 @@ from spyderlib.widgets.onecolumntree imp
 
8
 from spyderlib.widgets.texteditor import TextEditor
 
9
 from spyderlib.widgets.comboboxes import (PythonModulesComboBox,
 
10
                                           is_module_or_package)
 
11
-from spyderlib.py3compat import to_text_string, getcwd, pickle
 
12
+from spyderlib.py3compat import PY3, to_text_string, getcwd, pickle
 
13
 _ = get_translation("p_pylint", dirname="spyderplugins")
 
14
 
 
15
 
 
16
-PYLINT_PATH = programs.find_program('pylint')
 
17
+PYLINT = 'pylint'
 
18
+if PY3 and programs.find_program('pylint3'):
 
19
+    PYLINT = 'pylint3'
 
20
+
 
21
+PYLINT_PATH = programs.find_program(PYLINT)
 
22
 
 
23
 
 
24
 def get_pylint_version():
 
25
@@ -48,13 +52,13 @@ def get_pylint_version():
 
26
     global PYLINT_PATH
 
27
     if PYLINT_PATH is None:
 
28
         return
 
29
-    process = subprocess.Popen(['pylint', '--version'],
 
30
+    process = subprocess.Popen([PYLINT, '--version'],
 
31
                                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
 
32
                                cwd=osp.dirname(PYLINT_PATH),
 
33
                                shell=True if os.name == 'nt' else False)
 
34
     lines = to_unicode_from_fs(process.stdout.read()).splitlines()
 
35
     if lines:
 
36
-        match = re.match('(pylint|pylint-script.py) ([0-9\.]*)', lines[0])
 
37
+        match = re.match('(pylint3?|pylint-script.py) ([0-9\.]*)', lines[0])
 
38
         if match is not None:
 
39
             return match.groups()[1]
 
40