summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-04-14 14:38:58 (GMT)
committerGitHub <noreply@github.com>2021-04-14 14:38:58 (GMT)
commitd9ba9dee7f267a603394b8d63a7697b08efdf1cb (patch)
tree9f6a01f655309fdf01d4a00591925cae63b6cc24 /setup.py
parent92eebf6dd20c541ca5883d010a575fb6ea4a245c (diff)
downloadcpython-d9ba9dee7f267a603394b8d63a7697b08efdf1cb.zip
cpython-d9ba9dee7f267a603394b8d63a7697b08efdf1cb.tar.gz
cpython-d9ba9dee7f267a603394b8d63a7697b08efdf1cb.tar.bz2
bpo-41282: setup.py ignores distutils DeprecationWarning (GH-25405)
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/setup.py b/setup.py
index 253053d..f8b7a17 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,7 @@ import os
import re
import sys
import sysconfig
+import warnings
from glob import glob, escape
import _osx_support
@@ -30,14 +31,19 @@ except ImportError:
SUBPROCESS_BOOTSTRAP = True
-from distutils import log
-from distutils.command.build_ext import build_ext
-from distutils.command.build_scripts import build_scripts
-from distutils.command.install import install
-from distutils.command.install_lib import install_lib
-from distutils.core import Extension, setup
-from distutils.errors import CCompilerError, DistutilsError
-from distutils.spawn import find_executable
+with warnings.catch_warnings():
+ # bpo-41282 (PEP 632) deprecated distutils but setup.py still uses it
+ warnings.filterwarnings("ignore", "The distutils package is deprecated",
+ DeprecationWarning)
+
+ from distutils import log
+ from distutils.command.build_ext import build_ext
+ from distutils.command.build_scripts import build_scripts
+ from distutils.command.install import install
+ from distutils.command.install_lib import install_lib
+ from distutils.core import Extension, setup
+ from distutils.errors import CCompilerError, DistutilsError
+ from distutils.spawn import find_executable
# Compile extensions used to test Python?