control: tags -1 patch

Hello, I grabbed the upstream proposed patch and rebased on top of the version 
in Debian.

The result now builds fine and testsuite seems ok


attached!

G.
diff -Nru pylint-2.5.3/debian/changelog pylint-2.5.3/debian/changelog
--- pylint-2.5.3/debian/changelog       2020-07-21 08:18:14.000000000 +0200
+++ pylint-2.5.3/debian/changelog       2020-07-31 09:34:41.000000000 +0200
@@ -1,3 +1,10 @@
+pylint (2.5.3-1ubuntu1) groovy; urgency=medium
+
+  * debian/patches/3725.patch:
+    - cherry-pick and adapt upstream proposed fix for new isort
+
+ -- Gianfranco Costamagna <locutusofb...@debian.org>  Fri, 31 Jul 2020 
09:34:41 +0200
+
 pylint (2.5.3-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru pylint-2.5.3/debian/patches/3725.patch 
pylint-2.5.3/debian/patches/3725.patch
--- pylint-2.5.3/debian/patches/3725.patch      1970-01-01 01:00:00.000000000 
+0100
+++ pylint-2.5.3/debian/patches/3725.patch      2020-07-31 09:34:41.000000000 
+0200
@@ -0,0 +1,502 @@
+From db0a6524ac2b1709c1e295cc2377486f32da5bca Mon Sep 17 00:00:00 2001
+From: Damien Baty <damien.b...@polyconseil.fr>
+Date: Sun, 5 Jul 2020 23:06:04 +0200
+Subject: [PATCH 1/3] Support both isort 4 and isort 5
+
+The API of isort 5 (released on 2020-07-04) is completely different.
+We must still support isort 4 because isort 5 dropped the
+compatibility with Python 3.5, which pylint still supports.
+
+Fix #3722.
+---
+ ChangeLog                                 |  4 +++
+ pylint/__pkginfo__.py                     |  2 +-
+ pylint/checkers/imports.py                |  8 +++---
+ pylint/utils/__init__.py                  |  2 ++
+ pylint/utils/utils.py                     | 31 +++++++++++++++++++++++
+ tests/functional/w/wrong_import_order.txt |  6 ++---
+ tests/test_functional.py                  |  5 ++++
+ tox.ini                                   |  4 ++-
+ 8 files changed, 52 insertions(+), 10 deletions(-)
+
+Index: pylint/ChangeLog
+===================================================================
+--- pylint.orig/ChangeLog
++++ pylint/ChangeLog
+@@ -40,6 +40,10 @@
+ 
+   Close #3646
+ 
++* Support both isort 4 and isort 5.
++
++  Close #3722
++
+ 
+ What's New in Pylint 2.5.2?
+ ===========================
+Index: pylint/pylint/__pkginfo__.py
+===================================================================
+--- pylint.orig/pylint/__pkginfo__.py
++++ pylint/pylint/__pkginfo__.py
+@@ -37,7 +37,7 @@
+ 
+ install_requires = [
+     "astroid>=2.4.0,<=2.5",
+-    "isort>=4.2.5,<5",
++    "isort>=4.2.5,<6",
+     "mccabe>=0.6,<0.7",
+     "toml>=0.7.1",
+ ]
+Index: pylint/pylint/checkers/imports.py
+===================================================================
+--- pylint.orig/pylint/checkers/imports.py
++++ pylint/pylint/checkers/imports.py
+@@ -46,7 +46,6 @@
+ from distutils import sysconfig
+ 
+ import astroid
+-import isort
+ from astroid import modutils
+ from astroid.decorators import cached
+ 
+@@ -60,7 +59,7 @@
+ from pylint.graph import DotBackend, get_cycles
+ from pylint.interfaces import IAstroidChecker
+ from pylint.reporters.ureports.nodes import Paragraph, VerbatimText
+-from pylint.utils import get_global_option
++from pylint.utils import IsortDriver, get_global_option
+ 
+ 
+ def _qualified_names(modname):
+@@ -709,8 +708,7 @@
+         third_party_not_ignored = []
+         first_party_not_ignored = []
+         local_not_ignored = []
+-        isort_obj = isort.SortImports(
+-            file_contents="",
++        isort_driver = IsortDriver(
+             known_third_party=self.config.known_third_party,
+             known_standard_library=self.config.known_standard_library,
+         )
+@@ -723,7 +721,7 @@
+             ignore_for_import_order = not self.linter.is_message_enabled(
+                 "wrong-import-order", node.fromlineno
+             )
+-            import_category = isort_obj.place_module(package)
++            import_category = isort_driver.place_module(package)
+             node_and_package_import = (node, package)
+             if import_category in ("FUTURE", "STDLIB"):
+                 std_imports.append(node_and_package_import)
+Index: pylint/pylint/utils/__init__.py
+===================================================================
+--- pylint.orig/pylint/utils/__init__.py
++++ pylint/pylint/utils/__init__.py
+@@ -46,6 +46,8 @@
+ from pylint.utils.ast_walker import ASTWalker
+ from pylint.utils.file_state import FileState
+ from pylint.utils.utils import (
++    HAS_ISORT_5,
++    IsortDriver,
+     _basename_in_blacklist_re,
+     _check_csv,
+     _format_option_value,
+Index: pylint/pylint/utils/utils.py
+===================================================================
+--- pylint.orig/pylint/utils/utils.py
++++ pylint/pylint/utils/utils.py
+@@ -1,6 +1,15 @@
+ # Licensed under the GPL: 
https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ # For details: https://github.com/PyCQA/pylint/blob/master/COPYING
+ 
++try:
++    import isort.api
++
++    HAS_ISORT_5 = True
++except ImportError:  # isort < 5
++    import isort
++
++    HAS_ISORT_5 = False
++
+ import codecs
+ import os
+ import re
+@@ -398,3 +407,25 @@
+                 # remove trailing ',' from last element of the list
+                 value = value[:-1]
+             print("%s=%s" % (optname, value), file=stream)
++
++
++class IsortDriver:
++    """A wrapper around isort API that changed between versions 4 and 5."""
++
++    def __init__(self, known_third_party, known_standard_library):
++        if HAS_ISORT_5:
++            self.isort5_config = isort.api.Config(
++                known_third_party=known_third_party,
++                known_standard_library=known_standard_library,
++            )
++        else:
++            self.isort4_obj = isort.SortImports(  # pylint: disable=no-member
++                file_contents="",
++                known_third_party=known_third_party,
++                known_standard_library=known_standard_library,
++            )
++
++    def place_module(self, package):
++        if HAS_ISORT_5:
++            return isort.api.place_module(package, self.isort5_config)
++        return self.isort4_obj.place_module(package)
+Index: pylint/tests/functional/w/wrong_import_order.txt
+===================================================================
+--- pylint.orig/tests/functional/w/wrong_import_order.txt
++++ pylint/tests/functional/w/wrong_import_order.txt
+@@ -1,6 +1,6 @@
+ wrong-import-order:12::standard import "import os.path" should be placed 
before "import six"
+ wrong-import-order:14::standard import "import sys" should be placed before 
"import six"
+ wrong-import-order:15::standard import "import datetime" should be placed 
before "import six"
+-wrong-import-order:18::first party import "import totally_missing" should be 
placed before "from .package import Class"
+-wrong-import-order:20::third party import "import astroid" should be placed 
before "import unused_import"
+-wrong-import-order:24::third party import "from six.moves.urllib.parse import 
quote" should be placed before "import unused_import"
++wrong-import-order:18::third party import "import totally_missing" should be 
placed before "from .package import Class"
++wrong-import-order:20::third party import "import astroid" should be placed 
before "from .package import Class"
++wrong-import-order:24::third party import "from six.moves.urllib.parse import 
quote" should be placed before "from .package import Class"
+Index: pylint/tests/test_functional.py
+===================================================================
+--- pylint.orig/tests/test_functional.py
++++ pylint/tests/test_functional.py
+@@ -28,6 +28,7 @@
+ import pytest
+ 
+ from pylint import testutils
++from pylint.utils import HAS_ISORT_5
+ 
+ 
+ class test_dialect(csv.excel):
+@@ -77,6 +78,10 @@
+             continue
+         for filename in filenames:
+             if filename != "__init__.py" and filename.endswith(".py"):
++                # isort 5 has slightly different rules as isort 4. Testing
++                # both would be hard: test with isort 5 only.
++                if filename == "wrong_import_order.py" and not HAS_ISORT_5:
++                    continue
+                 suite.append(testutils.FunctionalTestFile(dirpath, filename))
+     return suite
+ 
+Index: pylint/pylint/checkers/base.py
+===================================================================
+--- pylint.orig/pylint/checkers/base.py
++++ pylint/pylint/checkers/base.py
+@@ -54,7 +54,6 @@
+ # For details: https://github.com/PyCQA/pylint/blob/master/COPYING
+ 
+ """basic checker for Python code"""
+-
+ import builtins
+ import collections
+ import itertools
+@@ -67,8 +66,8 @@
+ import astroid.scoped_nodes
+ from astroid.arguments import CallSite
+ 
+-import pylint.utils as lint_utils
+ from pylint import checkers, exceptions, interfaces
++from pylint import utils as lint_utils
+ from pylint.checkers import utils
+ from pylint.checkers.utils import (
+     is_overload_stub,
+Index: pylint/pylint/checkers/spelling.py
+===================================================================
+--- pylint.orig/pylint/checkers/spelling.py
++++ pylint/pylint/checkers/spelling.py
+@@ -21,7 +21,6 @@
+ 
+ """Checker for spelling errors in comments and docstrings.
+ """
+-
+ import os
+ import re
+ import tokenize
+@@ -33,12 +32,12 @@
+ try:
+     import enchant
+     from enchant.tokenize import (  # type: ignore
+-        get_tokenizer,
+         Chunker,
+-        Filter,
+         EmailFilter,
++        Filter,
+         URLFilter,
+         WikiWordFilter,
++        get_tokenizer,
+     )
+ except ImportError:
+     enchant = None
+Index: pylint/pylint/checkers/utils.py
+===================================================================
+--- pylint.orig/pylint/checkers/utils.py
++++ pylint/pylint/checkers/utils.py
+@@ -50,13 +50,12 @@
+ from functools import lru_cache, partial
+ from typing import Callable, Dict, Iterable, List, Match, Optional, Set, 
Tuple, Union
+ 
++import _string  # pylint: disable=wrong-import-position, wrong-import-order
+ import astroid
+ from astroid import bases as _bases
+ from astroid import helpers, scoped_nodes
+ from astroid.exceptions import _NonDeducibleTypeHierarchy
+ 
+-import _string  # pylint: disable=wrong-import-position, wrong-import-order
+-
+ BUILTINS_NAME = builtins.__name__
+ COMP_NODE_TYPES = (
+     astroid.ListComp,
+Index: pylint/pylint/epylint.py
+===================================================================
+--- pylint.orig/pylint/epylint.py
++++ pylint/pylint/epylint.py
+@@ -56,10 +56,10 @@
+ its output.
+ """
+ import os
+-import os.path as osp
+ import shlex
+ import sys
+ from io import StringIO
++from os import path as osp
+ from subprocess import PIPE, Popen
+ 
+ 
+Index: pylint/pylint/extensions/docparams.py
+===================================================================
+--- pylint.orig/pylint/extensions/docparams.py
++++ pylint/pylint/extensions/docparams.py
+@@ -21,9 +21,9 @@
+ """
+ import astroid
+ 
+-import pylint.extensions._check_docs_utils as utils
+ from pylint.checkers import BaseChecker
+ from pylint.checkers import utils as checker_utils
++from pylint.extensions import _check_docs_utils as utils
+ from pylint.interfaces import IAstroidChecker
+ 
+ 
+Index: pylint/pylint/graph.py
+===================================================================
+--- pylint.orig/pylint/graph.py
++++ pylint/pylint/graph.py
+@@ -13,13 +13,12 @@
+ 
+ (dot generation adapted from pypy/translator/tool/make_dot.py)
+ """
+-
+ import codecs
+ import os
+-import os.path as osp
+ import subprocess
+ import sys
+ import tempfile
++from os import path as osp
+ 
+ 
+ def target_info_from_filename(filename):
+Index: pylint/setup.py
+===================================================================
+--- pylint.orig/setup.py
++++ pylint/setup.py
+@@ -39,8 +39,8 @@
+ 
+     USE_SETUPTOOLS = 1
+ except ImportError:
+-    from distutils.core import setup
+     from distutils.command import install_lib  # pylint: disable=unused-import
++    from distutils.core import setup
+ 
+     USE_SETUPTOOLS = 0
+     easy_install_lib = None
+Index: pylint/tests/unittest_checker_typecheck.py
+===================================================================
+--- pylint.orig/tests/unittest_checker_typecheck.py
++++ pylint/tests/unittest_checker_typecheck.py
+@@ -26,7 +26,7 @@
+ from pylint.testutils import CheckerTestCase, Message, set_config
+ 
+ try:
+-    import coverage.tracer as _
++    from coverage import tracer as _  # pylint: disable=unused-import
+ 
+     C_EXTENTIONS_AVAILABLE = True
+ except ImportError:
+Index: pylint/tests/extensions/test_bad_builtin.py
+===================================================================
+--- pylint.orig/tests/extensions/test_bad_builtin.py
++++ pylint/tests/extensions/test_bad_builtin.py
+@@ -8,8 +8,7 @@
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.bad_builtin
+ """
+-
+-import os.path as osp
++from os import path as osp
+ 
+ import pytest
+ 
+Index: pylint/tests/extensions/test_broad_try_clause.py
+===================================================================
+--- pylint.orig/tests/extensions/test_broad_try_clause.py
++++ pylint/tests/extensions/test_broad_try_clause.py
+@@ -9,9 +9,8 @@
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.broad_try_clause
+ """
+-
+-import os.path as osp
+ import unittest
++from os import path as osp
+ 
+ from pylint import checkers
+ from pylint.extensions.broad_try_clause import BroadTryClauseChecker
+Index: pylint/tests/extensions/test_check_docs_utils.py
+===================================================================
+--- pylint.orig/tests/extensions/test_check_docs_utils.py
++++ pylint/tests/extensions/test_check_docs_utils.py
+@@ -14,7 +14,7 @@
+ import astroid
+ import pytest
+ 
+-import pylint.extensions._check_docs_utils as utils
++from pylint.extensions import _check_docs_utils as utils
+ 
+ 
+ @pytest.mark.parametrize(
+Index: pylint/tests/extensions/test_check_mccabe.py
+===================================================================
+--- pylint.orig/tests/extensions/test_check_mccabe.py
++++ pylint/tests/extensions/test_check_mccabe.py
+@@ -9,7 +9,7 @@
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.check_mccabe"""
+ 
+-import os.path as osp
++from os import path as osp
+ 
+ import pytest
+ 
+Index: pylint/tests/extensions/test_elseif_used.py
+===================================================================
+--- pylint.orig/tests/extensions/test_elseif_used.py
++++ pylint/tests/extensions/test_elseif_used.py
+@@ -9,8 +9,7 @@
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.check_elif
+ """
+-
+-import os.path as osp
++from os import path as osp
+ 
+ import pytest
+ 
+Index: pylint/tests/extensions/test_emptystring.py
+===================================================================
+--- pylint.orig/tests/extensions/test_emptystring.py
++++ pylint/tests/extensions/test_emptystring.py
+@@ -12,8 +12,7 @@
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.emptystring
+ """
+-
+-import os.path as osp
++from os import path as osp
+ 
+ import pytest
+ 
+Index: pylint/tests/extensions/test_redefined.py
+===================================================================
+--- pylint.orig/tests/extensions/test_redefined.py
++++ pylint/tests/extensions/test_redefined.py
+@@ -7,8 +7,7 @@
+ # For details: https://github.com/PyCQA/pylint/blob/master/COPYING
+ 
+ """Tests for the pylint checker in :mod:`pylint.extensions.check_elif"""
+-
+-import os.path as osp
++from os import path as osp
+ 
+ import pytest
+ 
+Index: pylint/tests/lint/unittest_lint.py
+===================================================================
+--- pylint.orig/tests/lint/unittest_lint.py
++++ pylint/tests/lint/unittest_lint.py
+@@ -46,8 +46,7 @@
+ 
+ import pytest
+ 
+-import pylint.testutils as testutils
+-from pylint import checkers, config, exceptions, interfaces, lint
++from pylint import checkers, config, exceptions, interfaces, lint, testutils
+ from pylint.checkers.utils import check_messages
+ from pylint.constants import (
+     MSG_STATE_CONFIDENCE,
+Index: pylint/tests/test_import_graph.py
+===================================================================
+--- pylint.orig/tests/test_import_graph.py
++++ pylint/tests/test_import_graph.py
+@@ -17,7 +17,7 @@
+ 
+ import pytest
+ 
+-import pylint.testutils as testutils
++from pylint import testutils
+ from pylint.checkers import imports, initialize
+ from pylint.lint import PyLinter
+ 
+Index: pylint/tests/test_regr.py
+===================================================================
+--- pylint.orig/tests/test_regr.py
++++ pylint/tests/test_regr.py
+@@ -23,7 +23,7 @@
+ import astroid
+ import pytest
+ 
+-import pylint.testutils as testutils
++from pylint import testutils
+ 
+ REGR_DATA = join(dirname(abspath(__file__)), "regrtest_data")
+ sys.path.insert(1, REGR_DATA)
+Index: pylint/tests/unittest_pyreverse_diadefs.py
+===================================================================
+--- pylint.orig/tests/unittest_pyreverse_diadefs.py
++++ pylint/tests/unittest_pyreverse_diadefs.py
+@@ -21,6 +21,7 @@
+ 
+ import astroid
+ import pytest
++from unittest_pyreverse_writer import Config, get_project
+ 
+ from pylint.pyreverse.diadefslib import (
+     ClassDiadefGenerator,
+@@ -29,7 +30,6 @@
+     DiadefsHandler,
+ )
+ from pylint.pyreverse.inspector import Linker
+-from unittest_pyreverse_writer import Config, get_project
+ 
+ 
+ def _process_classes(classes):
+Index: pylint/tests/unittest_pyreverse_inspector.py
+===================================================================
+--- pylint.orig/tests/unittest_pyreverse_inspector.py
++++ pylint/tests/unittest_pyreverse_inspector.py
+@@ -14,9 +14,9 @@
+ import astroid
+ import pytest
+ from astroid import bases, nodes
++from unittest_pyreverse_writer import get_project
+ 
+ from pylint.pyreverse import inspector
+-from unittest_pyreverse_writer import get_project
+ 
+ 
+ @pytest.fixture
diff -Nru pylint-2.5.3/debian/patches/series pylint-2.5.3/debian/patches/series
--- pylint-2.5.3/debian/patches/series  2020-07-21 08:18:14.000000000 +0200
+++ pylint-2.5.3/debian/patches/series  2020-07-31 09:34:41.000000000 +0200
@@ -1,2 +1,3 @@
 avoid-pip.patch
 gh_issue_3198.patch
+3725.patch

Reply via email to