Volshell: Attempt to resolve requirement conflicts

This change sets the `script`, `script-only`, and `primary` requirements
to only apply to the `generic.Volshell` class. `regex-scanner` is okay
to be shared between the base and inherited classes, but `script` and
`script-only` have to be generic-only in order to avoid conflicts when
populating the argparse parser.

`primary` must be generic-only in order to avoid ending up unsatisfied
when superclass requirements require a module, suppressing construction
of the `primary` layer.
This commit is contained in:
David McDonald
2025-03-28 13:22:01 -05:00
parent 9f024cf0f4
commit 03c6477902
+13 -12
View File
@@ -54,20 +54,24 @@ class Volshell(interfaces.plugins.PluginInterface):
@classmethod
def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]:
reqs: List[interfaces.configuration.RequirementInterface] = []
reqs: List[interfaces.configuration.RequirementInterface] = [
requirements.VersionRequirement(
name="regex_scanner",
component=scanners.RegExScanner,
version=(1, 0, 0),
),
]
if cls == Volshell:
reqs = [
reqs += [
requirements.TranslationLayerRequirement(
name="primary", description="Memory layer for the kernel"
),
requirements.URIRequirement(
name="script",
description="File to load and execute at start",
default=None,
optional=True,
),
requirements.VersionRequirement(
name="regex_scanner",
component=scanners.RegExScanner,
version=(1, 0, 0),
),
requirements.BooleanRequirement(
name="script-only",
description="Exit volshell after the script specified in --script completes",
@@ -75,11 +79,8 @@ class Volshell(interfaces.plugins.PluginInterface):
optional=True,
),
]
return reqs + [
requirements.TranslationLayerRequirement(
name="primary", description="Memory layer for the kernel"
),
]
return reqs
def run(
self, additional_locals: Dict[str, Any] = {}