Alternative to remove_with_requires
that doesn't remove components that still have other dependants
#17757
Labels
C-Feature
A new feature, making something new possible
S-Needs-Triage
This issue needs to be labelled
What problem does this solve or what need does it fill?
remove_with_requires
currently makes no additional checks to see if any other component requires the same dependencies. This can result in the method removing another component's required dependency.Take this example, where I expected
A
to remain because it is still required byC
What solution would you like?
Let required components have a sort of ref-counting of required components. The current implementation of
remove_with_requires
could be altered, or a soft variant called something likeremove_with_checked_requires
could be added. This method would only remove a required component if no remaining components still requires it.What alternative(s) have you considered?
It's possible to make your own function that makes sure to check if specific components are present before removing a dependency, and call that instead if you need to remove the required component.
The text was updated successfully, but these errors were encountered: