Skip to content

Commit d9ba9de

Browse files
authored
bpo-41282: setup.py ignores distutils DeprecationWarning (GH-25405)
1 parent 92eebf6 commit d9ba9de

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

setup.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import re
99
import sys
1010
import sysconfig
11+
import warnings
1112
from glob import glob, escape
1213
import _osx_support
1314

@@ -30,14 +31,19 @@
3031
SUBPROCESS_BOOTSTRAP = True
3132

3233

33-
from distutils import log
34-
from distutils.command.build_ext import build_ext
35-
from distutils.command.build_scripts import build_scripts
36-
from distutils.command.install import install
37-
from distutils.command.install_lib import install_lib
38-
from distutils.core import Extension, setup
39-
from distutils.errors import CCompilerError, DistutilsError
40-
from distutils.spawn import find_executable
34+
with warnings.catch_warnings():
35+
# bpo-41282 (PEP 632) deprecated distutils but setup.py still uses it
36+
warnings.filterwarnings("ignore", "The distutils package is deprecated",
37+
DeprecationWarning)
38+
39+
from distutils import log
40+
from distutils.command.build_ext import build_ext
41+
from distutils.command.build_scripts import build_scripts
42+
from distutils.command.install import install
43+
from distutils.command.install_lib import install_lib
44+
from distutils.core import Extension, setup
45+
from distutils.errors import CCompilerError, DistutilsError
46+
from distutils.spawn import find_executable
4147

4248

4349
# Compile extensions used to test Python?

0 commit comments

Comments
 (0)