Skip to content
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

Use the new sysconfig module instead of distutils #130

Merged
merged 1 commit into from
Aug 30, 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
25 changes: 12 additions & 13 deletions autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import signal
import string
import sys
import sysconfig
import tokenize

import distutils.sysconfig
import pyflakes.api
import pyflakes.messages
import pyflakes.reporter
Expand All @@ -55,19 +55,18 @@

def standard_paths():
"""Yield paths to standard modules."""
for is_plat_spec in [True, False]:

paths = sysconfig.get_paths()
path_names = ['stdlib', 'platstdlib']
for path_name in path_names:
# Yield lib paths.
path = distutils.sysconfig.get_python_lib(
standard_lib=True,
plat_specific=is_plat_spec,
)
yield from os.listdir(path)

# Yield lib-dynload paths.
dynload_path = os.path.join(path, 'lib-dynload')
if os.path.isdir(dynload_path):
yield from os.listdir(dynload_path)
if path_name in paths:
path = paths[path_name]
yield from os.listdir(path)

# Yield lib-dynload paths.
dynload_path = os.path.join(path, 'lib-dynload')
if os.path.isdir(dynload_path):
yield from os.listdir(dynload_path)


def standard_package_names():
Expand Down