meta: support for inputs
Inputs are modules like Stages, Assemblers and Sources. Add them as a new module klass to the various functions. Include them in the schema test, so the schema of all inputs is validated. Also sort the module classes alphabetically in the class mapping and class list.
This commit is contained in:
parent
3bccc82ce9
commit
7084c2a600
2 changed files with 5 additions and 4 deletions
|
|
@ -359,9 +359,10 @@ class ModuleInfo:
|
|||
@staticmethod
|
||||
def module_class_to_directory(klass: str) -> str:
|
||||
mapping = {
|
||||
"Stage": "stages",
|
||||
"Assembler": "assemblers",
|
||||
"Source": "sources"
|
||||
"Input": "inputs",
|
||||
"Source": "sources",
|
||||
"Stage": "stages",
|
||||
}
|
||||
|
||||
return mapping.get(klass)
|
||||
|
|
@ -419,7 +420,7 @@ class Index:
|
|||
with contextlib.suppress(FileNotFoundError):
|
||||
with open(path, "r") as f:
|
||||
schema = json.load(f)
|
||||
elif klass in ["Stage", "Assembler", "Source"]:
|
||||
elif klass in ["Assembler", "Input", "Source", "Stage"]:
|
||||
info = self.get_module_info(klass, name)
|
||||
if info:
|
||||
schema = info.schema
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TestDescriptions(unittest.TestCase):
|
|||
index = osbuild.meta.Index(os.curdir)
|
||||
|
||||
modules = []
|
||||
for klass in ("Stage", "Assembler", "Source"):
|
||||
for klass in ("Assembler", "Input", "Source", "Stage"):
|
||||
mods = index.list_modules_for_class(klass)
|
||||
modules += [(klass, module) for module in mods]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue