diff options
-rw-r--r-- | __pkginfo__.py | 6 | ||||
-rw-r--r-- | checkers/utils.py | 2 | ||||
-rw-r--r-- | checkers/variables.py | 2 | ||||
-rw-r--r-- | reporters/__init__.py | 4 | ||||
-rw-r--r-- | setup.py | 7 | ||||
-rw-r--r-- | test/input/func_unpack_exception_py_30.py | 4 | ||||
-rw-r--r-- | test/input/func_w0623_py30.py | 2 | ||||
-rw-r--r-- | testutils.py | 1 |
8 files changed, 21 insertions, 7 deletions
diff --git a/__pkginfo__.py b/__pkginfo__.py index d0ad387..e041e03 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -15,13 +15,17 @@ # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """pylint packaging information""" +import sys modname = distname = 'pylint' numversion = (1, 1, 0) version = '.'.join([str(num) for num in numversion]) -install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.0.1'] +if sys.version_info < (2, 6): + install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.0.1', 'StringFormat'] +else: + install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.0.1'] license = 'GPL' description = "python code static checker" diff --git a/checkers/utils.py b/checkers/utils.py index 78deb4e..e7d85d4 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -407,7 +407,7 @@ def get_argument_from_call(callfunc_node, position=None, keyword=None): try: if position is not None and not isinstance(callfunc_node.args[position], astroid.Keyword): return callfunc_node.args[position] - except IndexError as error: + except IndexError, error: raise NoSuchArgumentError(error) if keyword: for arg in callfunc_node.args: diff --git a/checkers/variables.py b/checkers/variables.py index cbb1431..7c489e8 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -233,7 +233,7 @@ builtins. Remember that you should avoid to define new builtins when possible.' self.add_message('undefined-all-variable', args=elt_name, node=elt) - except SyntaxError as exc: + except SyntaxError, exc: # don't yield an syntax-error warning, # because it will be later yielded # when the file will be checked diff --git a/reporters/__init__.py b/reporters/__init__.py index e3d93ef..ced2f77 100644 --- a/reporters/__init__.py +++ b/reporters/__init__.py @@ -28,6 +28,10 @@ if sys.version_info >= (3, 0): def cmp(a, b): return (a > b) - (a < b) +import stringformat +if sys.version_info < (2, 6): + stringformat.init(True) + def diff_string(old, new): """given a old and new int value, return a string representing the difference @@ -131,7 +131,12 @@ class MyInstallLib(install_lib.install_lib): else: exclude = set() shutil.rmtree(dest, ignore_errors=True) - shutil.copytree(directory, dest, ignore=lambda dir, names: list(set(names) & exclude)) + shutil.copytree(directory, dest) + for (dirpath, dirnames, filenames) in os.walk(dest): + for n in filenames: + if n in exclude: + os.remove(os.path.join(dirpath, n)) + if sys.version_info >= (3, 0): # process manually python file in include_dirs (test data) diff --git a/test/input/func_unpack_exception_py_30.py b/test/input/func_unpack_exception_py_30.py index cf2e237..356915e 100644 --- a/test/input/func_unpack_exception_py_30.py +++ b/test/input/func_unpack_exception_py_30.py @@ -6,8 +6,8 @@ def new_style(): """Some exceptions can be unpacked.""" try: pass - except IOError as (errno, message): # this is fine + except IOError, (errno, message): # this is fine print errno, message - except IOError as (new_style, tuple): # W0623 twice + except IOError, (new_style, tuple): # W0623 twice print new_style, tuple diff --git a/test/input/func_w0623_py30.py b/test/input/func_w0623_py30.py index 163256b..f6c5f57 100644 --- a/test/input/func_w0623_py30.py +++ b/test/input/func_w0623_py30.py @@ -12,5 +12,5 @@ def some_function(): try: {}["a"] - except KeyError as some_function: # W0623 + except KeyError, some_function: # W0623 pass diff --git a/testutils.py b/testutils.py index 16c8845..17af707 100644 --- a/testutils.py +++ b/testutils.py @@ -14,6 +14,7 @@ # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """functional/non regression tests for pylint""" +from __future__ import with_statement import collections import contextlib |