Skip to content

Commit 2a7d977

Browse files
authored
build: remove usage of distutils in setup.py. (#1823)
1 parent 9d0eb02 commit 2a7d977

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

setup.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33

44
"""Code coverage measurement for Python"""
55

6-
# Distutils setup for coverage.py
6+
# Setuptools setup for coverage.py
77
# This file is used unchanged under all versions of Python.
88

99
import os
1010
import sys
1111

12-
# Setuptools has to be imported before distutils, or things break.
13-
from setuptools import setup
14-
from distutils.core import Extension # pylint: disable=wrong-import-order
12+
from setuptools import Extension, errors, setup
1513
from setuptools.command.build_ext import build_ext # pylint: disable=wrong-import-order
16-
from distutils import errors # pylint: disable=wrong-import-order
1714

1815
# Get or massage our metadata. We exec coverage/version.py so we can avoid
1916
# importing the product code into setup.py.
@@ -131,12 +128,11 @@
131128

132129
ext_errors = (
133130
errors.CCompilerError,
134-
errors.DistutilsExecError,
135-
errors.DistutilsPlatformError,
131+
errors.ExecError,
132+
errors.PlatformError,
136133
)
137134
if sys.platform == "win32":
138-
# distutils.msvc9compiler can raise an IOError when failing to
139-
# find the compiler
135+
# IOError can be raised when failing to find the compiler
140136
ext_errors += (IOError,)
141137

142138

@@ -155,7 +151,7 @@ def run(self):
155151
"""Wrap `run` with `BuildFailed`."""
156152
try:
157153
build_ext.run(self)
158-
except errors.DistutilsPlatformError as exc:
154+
except errors.PlatformError as exc:
159155
raise BuildFailed() from exc
160156

161157
def build_extension(self, ext):

0 commit comments

Comments
 (0)