@@ -491,50 +491,6 @@ def is_editable(self) -> bool:
491491 def source_link (self ) -> Optional [Link ]:
492492 return self .base .source_link
493493
494- def _warn_invalid_extras (
495- self ,
496- requested : FrozenSet [str ],
497- valid : FrozenSet [str ],
498- ) -> None :
499- """Emit warnings for invalid extras being requested.
500-
501- This emits a warning for each requested extra that is not in the
502- candidate's ``Provides-Extra`` list.
503- """
504- invalid_extras_to_warn = frozenset (
505- extra
506- for extra in requested
507- if extra not in valid
508- # If an extra is requested in an unnormalized form, skip warning
509- # about the normalized form being missing.
510- and extra in self .extras
511- )
512- if not invalid_extras_to_warn :
513- return
514- for extra in sorted (invalid_extras_to_warn ):
515- logger .warning (
516- "%s %s does not provide the extra '%s'" ,
517- self .base .name ,
518- self .version ,
519- extra ,
520- )
521-
522- def _calculate_valid_requested_extras (self ) -> FrozenSet [str ]:
523- """Get a list of valid extras requested by this candidate.
524-
525- The user (or upstream dependant) may have specified extras that the
526- candidate doesn't support. Any unsupported extras are dropped, and each
527- cause a warning to be logged here.
528- """
529- requested_extras = self .extras
530- valid_extras = frozenset (
531- extra
532- for extra in requested_extras
533- if self .base .dist .is_extra_provided (extra )
534- )
535- self ._warn_invalid_extras (requested_extras , valid_extras )
536- return valid_extras
537-
538494 def iter_dependencies (self , with_requires : bool ) -> Iterable [Optional [Requirement ]]:
539495 factory = self .base ._factory
540496
@@ -544,7 +500,18 @@ def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requiremen
544500 if not with_requires :
545501 return
546502
547- valid_extras = self ._calculate_valid_requested_extras ()
503+ # The user may have specified extras that the candidate doesn't
504+ # support. We ignore any unsupported extras here.
505+ valid_extras = self .extras .intersection (self .base .dist .iter_provided_extras ())
506+ invalid_extras = self .extras .difference (self .base .dist .iter_provided_extras ())
507+ for extra in sorted (invalid_extras ):
508+ logger .warning (
509+ "%s %s does not provide the extra '%s'" ,
510+ self .base .name ,
511+ self .version ,
512+ extra ,
513+ )
514+
548515 for r in self .base .dist .iter_dependencies (valid_extras ):
549516 yield from factory .make_requirements_from_spec (
550517 str (r ),
0 commit comments