@@ -849,7 +849,13 @@ def _parse_command_opts(self, parser, args):
849
849
args [:1 ] = shlex .split (alias , True )
850
850
command = args [0 ]
851
851
852
- nargs = _Distribution ._parse_command_opts (self , parser , args )
852
+ try :
853
+ nargs = _Distribution ._parse_command_opts (self , parser , args )
854
+ except Exception as ex :
855
+ if "--dist-info-dir" in args and "dist-info-dir not recognized" in str (ex ):
856
+ nargs = self ._workaround_dist_info_dir (parser , args )
857
+ else :
858
+ raise
853
859
854
860
# Handle commands that want to consume all remaining arguments
855
861
cmd_class = self .get_command_class (command )
@@ -860,6 +866,13 @@ def _parse_command_opts(self, parser, args):
860
866
861
867
return nargs
862
868
869
+ def _workaround_dist_info_dir (self , parser , args ):
870
+ # pypa/setuptools#4683
871
+ _IncompatibleBdistWheel .emit ()
872
+ i = args .index ("--dist-info-dir" )
873
+ args = args [:i ] + args [i + 2 :] # Remove problematic arguments
874
+ return _Distribution ._parse_command_opts (self , parser , args )
875
+
863
876
def get_cmdline_options (self ):
864
877
"""Return a '{cmd: {opt:val}}' map of all command-line options
865
878
@@ -953,3 +966,14 @@ def run_command(self, command):
953
966
class DistDeprecationWarning (SetuptoolsDeprecationWarning ):
954
967
"""Class for warning about deprecations in dist in
955
968
setuptools. Not ignored by default, unlike DeprecationWarning."""
969
+
970
+
971
+ class _IncompatibleBdistWheel (SetuptoolsDeprecationWarning ):
972
+ _SUMMARY = "wheel.bdist_wheel is deprecated, please import it from setuptools"
973
+ _DETAILS = """
974
+ Ensure that any custom bdist_wheel implementation is a subclass of
975
+ setuptools.command.bdist_wheel.bdist_wheel.
976
+ """
977
+ _DUE_DATE = (2025 , 10 , 15 )
978
+ # Initially introduced in 2024/10/15, but maybe too disruptive to be enforced?
979
+ _SEE_URL = "https://github.com/pypa/wheel/pull/631"
0 commit comments