Commit 0e5f953e by Randy Döring Committed by Arun Babu Neelicattu

group_command: improve interface for subclassing

parent 6beef611
...@@ -61,6 +61,15 @@ class GroupCommand(EnvCommand): ...@@ -61,6 +61,15 @@ class GroupCommand(EnvCommand):
} }
@property @property
def default_groups(self) -> set[str]:
"""
The groups that are considered by the command by default.
Can be overridden to adapt behavior.
"""
return self.non_optional_groups
@property
def activated_groups(self) -> set[str]: def activated_groups(self) -> set[str]:
groups = {} groups = {}
...@@ -93,9 +102,9 @@ class GroupCommand(EnvCommand): ...@@ -93,9 +102,9 @@ class GroupCommand(EnvCommand):
"</warning>" "</warning>"
) )
return groups["only"] or self.non_optional_groups.union( return groups["only"] or self.default_groups.union(groups["with"]).difference(
groups["with"] groups["without"]
).difference(groups["without"]) )
def project_with_activated_groups_only(self) -> ProjectPackage: def project_with_activated_groups_only(self) -> ProjectPackage:
return self.poetry.package.with_dependency_groups( return self.poetry.package.with_dependency_groups(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment