Skip to content

Removed unused detection of site-packages directory #5874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions pylint/checkers/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
import collections
import copy
import os
import sys
from distutils import sysconfig
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union

import astroid
Expand Down Expand Up @@ -441,33 +439,6 @@ def __init__(self, linter: Optional["PyLinter"] = None) -> None:
("RP0402", "Modules dependencies graph", self._report_dependencies_graph),
)

self._site_packages = self._compute_site_packages()

@staticmethod
def _compute_site_packages():
def _normalized_path(path):
return os.path.normcase(os.path.abspath(path))

paths = set()
real_prefix = getattr(sys, "real_prefix", None)
for prefix in filter(None, (real_prefix, sys.prefix)):
path = sysconfig.get_python_lib(prefix=prefix)
path = _normalized_path(path)
paths.add(path)

# Handle Debian's derivatives /usr/local.
if os.path.isfile("/etc/debian_version"):
for prefix in filter(None, (real_prefix, sys.prefix)):
libpython = os.path.join(
prefix,
"local",
"lib",
"python" + sysconfig.get_python_version(),
"dist-packages",
)
paths.add(libpython)
return paths

def open(self):
"""Called before visiting project (i.e set of modules)."""
self.linter.stats.dependencies = {}
Expand Down