Skip to content
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

import from setuptools instead of distutils #399

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Unreleased
- Drop support for Python 3.7.
- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
:pr:`348`
- Change ``distutils`` imports to ``setuptools``. :pr:`399`


Version 2.1.3
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import platform
import sys

from distutils.errors import CCompilerError
from distutils.errors import DistutilsExecError
from distutils.errors import DistutilsPlatformError
from setuptools import Extension
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.errors import CCompilerError
from setuptools.errors import ExecError
from setuptools.errors import PlatformError

ext_modules = [Extension("markupsafe._speedups", ["src/markupsafe/_speedups.c"])]

Expand All @@ -21,14 +21,14 @@ class ve_build_ext(build_ext):

def run(self):
try:
build_ext.run(self)
except DistutilsPlatformError as e:
super().run()
except PlatformError as e:
raise BuildFailed() from e

def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except (CCompilerError, DistutilsExecError, DistutilsPlatformError) as e:
super().build_extension(ext)
except (CCompilerError, ExecError, PlatformError) as e:
raise BuildFailed() from e
except ValueError as e:
# this can happen on Windows 64 bit, see Python issue 7511
Expand Down