Skip to content

Remove usage of distutils in setup.py (fix #1820) #1823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@

"""Code coverage measurement for Python"""

# Distutils setup for coverage.py
# Setuptools setup for coverage.py
# This file is used unchanged under all versions of Python.

import os
import sys

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

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

ext_errors = (
errors.CCompilerError,
errors.DistutilsExecError,
errors.DistutilsPlatformError,
errors.ExecError,
errors.PlatformError,
)
if sys.platform == "win32":
# distutils.msvc9compiler can raise an IOError when failing to
# find the compiler
# IOError can be raised when failing to find the compiler
ext_errors += (IOError,)


Expand All @@ -155,7 +151,7 @@ def run(self):
"""Wrap `run` with `BuildFailed`."""
try:
build_ext.run(self)
except errors.DistutilsPlatformError as exc:
except errors.PlatformError as exc:
raise BuildFailed() from exc

def build_extension(self, ext):
Expand Down
Loading