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 dd7a258
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,13 @@ def _parse_command_opts(self, parser, args):
args[:1] = shlex.split(alias, True)
command = args[0]

nargs = _Distribution._parse_command_opts(self, parser, args)
try:
nargs = _Distribution._parse_command_opts(self, parser, args)
except Exception as ex:
if "--dist-info-dir" in args and "dist-info-dir not recognized" in str(ex):
nargs = self._workaround_dist_info_dir(parser, args)
else:
raise

# Handle commands that want to consume all remaining arguments
cmd_class = self.get_command_class(command)
Expand All @@ -860,6 +866,13 @@ def _parse_command_opts(self, parser, args):

return nargs

def _workaround_dist_info_dir(self, parser, args):
# pypa/setuptools#4683
_IncompatibleBdistWheel.emit()
i = args.index("--dist-info-dir")
args = args[:i] + args[i + 2 :] # Remove problematic arguments
return _Distribution._parse_command_opts(self, parser, args)

def get_cmdline_options(self):
"""Return a '{cmd: {opt:val}}' map of all command-line options
Expand Down Expand Up @@ -953,3 +966,14 @@ def run_command(self, command):
class DistDeprecationWarning(SetuptoolsDeprecationWarning):
"""Class for warning about deprecations in dist in
setuptools. Not ignored by default, unlike DeprecationWarning."""


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"

0 comments on commit dd7a258

Please sign in to comment.