[Python-checkins] bpo-40443: Remove unused imports in distutils (GH-19802)

Victor Stinner webhook-mailer at python.org
Thu Apr 30 05:28:14 EDT 2020


https://github.com/python/cpython/commit/e488e300f5c01289c10906c2e53a8e43d6de32d8
commit: e488e300f5c01289c10906c2e53a8e43d6de32d8
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-30T11:28:09+02:00
summary:

bpo-40443: Remove unused imports in distutils (GH-19802)

files:
M Lib/distutils/_msvccompiler.py
M Lib/distutils/bcppcompiler.py
M Lib/distutils/ccompiler.py
M Lib/distutils/command/bdist_rpm.py
M Lib/distutils/command/bdist_wininst.py
M Lib/distutils/command/check.py
M Lib/distutils/command/upload.py
M Lib/distutils/cygwinccompiler.py
M Lib/distutils/msvc9compiler.py
M Lib/distutils/msvccompiler.py
M Lib/distutils/sysconfig.py

diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py
index 03a5986d984dc..af8099a407819 100644
--- a/Lib/distutils/_msvccompiler.py
+++ b/Lib/distutils/_msvccompiler.py
@@ -14,8 +14,6 @@
 # ported to VS 2015 by Steve Dower
 
 import os
-import shutil
-import stat
 import subprocess
 import winreg
 
@@ -65,8 +63,6 @@ def _find_vc2017():
     If vswhere.exe is not available, by definition, VS 2017 is not
     installed.
     """
-    import json
-
     root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles")
     if not root:
         return None, None
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py
index 9f4c432d90e77..071fea5d038cb 100644
--- a/Lib/distutils/bcppcompiler.py
+++ b/Lib/distutils/bcppcompiler.py
@@ -14,10 +14,10 @@
 
 import os
 from distutils.errors import \
-     DistutilsExecError, DistutilsPlatformError, \
+     DistutilsExecError, \
      CompileError, LibError, LinkError, UnknownFileError
 from distutils.ccompiler import \
-     CCompiler, gen_preprocess_options, gen_lib_options
+     CCompiler, gen_preprocess_options
 from distutils.file_util import write_file
 from distutils.dep_util import newer
 from distutils import log
diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
index 4cfc6c7065e92..b5ef143e72c56 100644
--- a/Lib/distutils/ccompiler.py
+++ b/Lib/distutils/ccompiler.py
@@ -8,7 +8,7 @@
 from distutils.spawn import spawn
 from distutils.file_util import move_file
 from distutils.dir_util import mkpath
-from distutils.dep_util import newer_pairwise, newer_group
+from distutils.dep_util import newer_group
 from distutils.util import split_quoted, execute
 from distutils import log
 
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py
index 74381cc69a6ce..550cbfa1e28a2 100644
--- a/Lib/distutils/command/bdist_rpm.py
+++ b/Lib/distutils/command/bdist_rpm.py
@@ -6,7 +6,6 @@
 import subprocess, sys, os
 from distutils.core import Command
 from distutils.debug import DEBUG
-from distutils.util import get_platform
 from distutils.file_util import write_file
 from distutils.errors import *
 from distutils.sysconfig import get_python_version
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py
index b5ed6f041e19a..0e9ddaa21419e 100644
--- a/Lib/distutils/command/bdist_wininst.py
+++ b/Lib/distutils/command/bdist_wininst.py
@@ -8,7 +8,7 @@
 import warnings
 from distutils.core import Command
 from distutils.util import get_platform
-from distutils.dir_util import create_tree, remove_tree
+from distutils.dir_util import remove_tree
 from distutils.errors import *
 from distutils.sysconfig import get_python_version
 from distutils import log
diff --git a/Lib/distutils/command/check.py b/Lib/distutils/command/check.py
index 7ceabd3adf22d..ada250064678e 100644
--- a/Lib/distutils/command/check.py
+++ b/Lib/distutils/command/check.py
@@ -11,7 +11,6 @@
     from docutils.parsers.rst import Parser
     from docutils import frontend
     from docutils import nodes
-    from io import StringIO
 
     class SilentReporter(Reporter):
 
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 11afa24b777a1..d822ba01338af 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -7,7 +7,6 @@
 
 import os
 import io
-import platform
 import hashlib
 from base64 import standard_b64encode
 from urllib.request import urlopen, Request, HTTPError
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
index 6c5d77746b6f5..66c12dd35830b 100644
--- a/Lib/distutils/cygwinccompiler.py
+++ b/Lib/distutils/cygwinccompiler.py
@@ -51,12 +51,10 @@
 from subprocess import Popen, PIPE, check_output
 import re
 
-from distutils.ccompiler import gen_preprocess_options, gen_lib_options
 from distutils.unixccompiler import UnixCCompiler
 from distutils.file_util import write_file
 from distutils.errors import (DistutilsExecError, CCompilerError,
         CompileError, UnknownFileError)
-from distutils import log
 from distutils.version import LooseVersion
 from distutils.spawn import find_executable
 
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
index 4c0036a0f1330..6934e964abd69 100644
--- a/Lib/distutils/msvc9compiler.py
+++ b/Lib/distutils/msvc9compiler.py
@@ -19,8 +19,7 @@
 
 from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
                              CompileError, LibError, LinkError
-from distutils.ccompiler import CCompiler, gen_preprocess_options, \
-                                gen_lib_options
+from distutils.ccompiler import CCompiler, gen_lib_options
 from distutils import log
 from distutils.util import get_platform
 
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
index d1de2fbfcb947..d5857cb1ffe42 100644
--- a/Lib/distutils/msvccompiler.py
+++ b/Lib/distutils/msvccompiler.py
@@ -13,7 +13,7 @@
      DistutilsExecError, DistutilsPlatformError, \
      CompileError, LibError, LinkError
 from distutils.ccompiler import \
-     CCompiler, gen_preprocess_options, gen_lib_options
+     CCompiler, gen_lib_options
 from distutils import log
 
 _can_read_reg = False
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 01ee519792932..37feae5df72c9 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -15,7 +15,6 @@
 import sys
 
 from .errors import DistutilsPlatformError
-from .util import get_platform, get_host_platform
 
 # These are needed in a couple of spots, so just compute them once.
 PREFIX = os.path.normpath(sys.prefix)



More information about the Python-checkins mailing list