diff --git a/ChangeLog b/ChangeLog index 76c15f0f38..277ff38411 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,10 @@ Release date: TBA * Require Python 3.6.2 to use astroid. +* Removed custom ``distutils`` handling for resolving paths to submodules. + + Ref #1321 + * Fix ``deque.insert()`` signature in ``collections`` brain. Closes #1260 diff --git a/astroid/interpreter/_import/spec.py b/astroid/interpreter/_import/spec.py index 43f00153a3..57bab9f434 100644 --- a/astroid/interpreter/_import/spec.py +++ b/astroid/interpreter/_import/spec.py @@ -17,7 +17,6 @@ import abc import collections -import distutils import enum import importlib.machinery import os @@ -161,12 +160,6 @@ def contribute_to_path(self, spec, processed): for p in sys.path if os.path.isdir(os.path.join(p, *processed)) ] - # We already import distutils elsewhere in astroid, - # so if it is the same module, we can use it directly. - elif spec.name == "distutils" and spec.location in distutils.__path__: - # distutils is patched inside virtualenvs to pick up submodules - # from the original Python, not from the virtualenv itself. - path = list(distutils.__path__) else: path = [spec.location] return path diff --git a/tests/unittest_modutils.py b/tests/unittest_modutils.py index a8107f7095..1cd7878432 100644 --- a/tests/unittest_modutils.py +++ b/tests/unittest_modutils.py @@ -22,7 +22,6 @@ """ unit tests for module modutils (module manipulation utilities) """ -import distutils.version import email import os import shutil @@ -72,10 +71,6 @@ def test_find_egg_module(self) -> None: ["data", "MyPyPa-0.1.0-py2.5.egg", self.package], ) - def test_find_distutils_submodules_in_virtualenv(self) -> None: - found_spec = spec.find_spec(["distutils", "version"]) - self.assertEqual(found_spec.location, distutils.version.__file__) - class LoadModuleFromNameTest(unittest.TestCase): """load a python module from it's name"""