Skip to content

Commit

Permalink
Workaround for bdist_wheel.dist_info_dir problems
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Oct 15, 2024
1 parent b828db4 commit 96be735
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,27 @@ def build_wheel(
config_settings: _ConfigSettings = None,
metadata_directory: StrPath | None = None,
):
cmd = ['bdist_wheel']
if metadata_directory:
cmd.extend(['--dist-info-dir', metadata_directory])
with suppress_known_deprecation():
return self._build_with_temp_dir(
cmd,
'.whl',
wheel_directory,
config_settings,
self._arbitrary_args(config_settings),
)
def _build(cmd: list[str]):
with suppress_known_deprecation():
return self._build_with_temp_dir(
cmd,
'.whl',
wheel_directory,
config_settings,
self._arbitrary_args(config_settings),
)

if metadata_directory is None:
return _build(['bdist_wheel'])

try:
return _build(['bdist_wheel', '--dist-info-dir', metadata_directory])
except SystemExit as ex:
# pypa/setuptools#4683
if "--dist-info-dir" not in str(ex):
raise
_IncompatibleBdistWheel.emit()
return _build(['bdist_wheel'])

def build_sdist(
self, sdist_directory: StrPath, config_settings: _ConfigSettings = None
Expand Down Expand Up @@ -514,6 +524,17 @@ def run_setup(self, setup_script='setup.py'):
sys.argv[0] = sys_argv_0


class _IncompatibleBdistWheel(SetuptoolsDeprecationWarning):
_SUMMARY = "wheel.bdist_wheel is deprecated, please import it from setuptools"
_DETAILS = """
Ensure that any custom bdist_wheel implementation is a subclass of
setuptools.command.bdist_wheel.bdist_wheel.
"""
_DUE_DATE = (2025, 10, 15)
# Initially introduced in 2024/10/15, but maybe too disruptive to be enforced?
_SEE_URL = "https://github.com/pypa/wheel/pull/631"


# The primary backend
_BACKEND = _BuildMetaBackend()

Expand Down

0 comments on commit 96be735

Please sign in to comment.