3
3
4
4
"""Code coverage measurement for Python"""
5
5
6
- # Distutils setup for coverage.py
6
+ # Setuptools setup for coverage.py
7
7
# This file is used unchanged under all versions of Python.
8
8
9
9
import os
10
10
import sys
11
11
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
15
13
from setuptools .command .build_ext import build_ext # pylint: disable=wrong-import-order
16
- from distutils import errors # pylint: disable=wrong-import-order
17
14
18
15
# Get or massage our metadata. We exec coverage/version.py so we can avoid
19
16
# importing the product code into setup.py.
131
128
132
129
ext_errors = (
133
130
errors .CCompilerError ,
134
- errors .DistutilsExecError ,
135
- errors .DistutilsPlatformError ,
131
+ errors .ExecError ,
132
+ errors .PlatformError ,
136
133
)
137
134
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
140
136
ext_errors += (IOError ,)
141
137
142
138
@@ -155,7 +151,7 @@ def run(self):
155
151
"""Wrap `run` with `BuildFailed`."""
156
152
try :
157
153
build_ext .run (self )
158
- except errors .DistutilsPlatformError as exc :
154
+ except errors .PlatformError as exc :
159
155
raise BuildFailed () from exc
160
156
161
157
def build_extension (self , ext ):
0 commit comments