Skip to content

Commit

Permalink
Ensured all methods in setuptools.modified raise a consistant `dist…
Browse files Browse the repository at this point in the history
…utils.error.DistutilsError` type
  • Loading branch information
Avasam committed Aug 27, 2024
1 parent e55c19e commit d6db114
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions newsfragments/4567.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensured all methods in ``setuptools.modified`` raise a consistant ``distutils.error.DistutilsError`` type -- by :user:`Avasam`
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,3 @@ formats = "zip"


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143
9 changes: 1 addition & 8 deletions setuptools/command/build_clib.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
from ..dist import Distribution
from ..modified import newer_pairwise_group

import distutils.command.build_clib as orig
from distutils import log
from distutils.errors import DistutilsSetupError

try:
from distutils._modified import ( # pyright: ignore[reportMissingImports]
newer_pairwise_group,
)
except ImportError:
# fallback for SETUPTOOLS_USE_DISTUTILS=stdlib
from .._distutils._modified import newer_pairwise_group


class build_clib(orig.build_clib):
"""
Expand Down
22 changes: 16 additions & 6 deletions setuptools/modified.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
from ._distutils._modified import (
newer,
newer_group,
newer_pairwise,
newer_pairwise_group,
)
try:
# Ensure a DistutilsError raised by these methods is the same as distutils.error.DistutilsError
from distutils._modified import (
newer,
newer_group,
newer_pairwise,
newer_pairwise_group,
)
except ImportError:
# fallback for SETUPTOOLS_USE_DISTUTILS=stdlib, because _modified never existed in stdlib
from ._distutils._modified import (
newer,
newer_group,
newer_pairwise,
newer_pairwise_group,
)

__all__ = ['newer', 'newer_pairwise', 'newer_group', 'newer_pairwise_group']

0 comments on commit d6db114

Please sign in to comment.