use 'product_types' instead of 'families' in loader plugins

This commit is contained in:
Jakub Trllo 2024-03-18 13:57:39 +01:00
parent 4ab0119f3a
commit e498b0aafe
4 changed files with 15 additions and 14 deletions

View file

@ -24,7 +24,7 @@ class LoaderPlugin(list):
"""
families = []
product_types = []
representations = []
extensions = {"*"}
order = 0
@ -118,7 +118,7 @@ class LoaderPlugin(list):
On override make sure it is overriden as class or static method.
This checks the version's families and the representation for the given
This checks the product type and the representation for the given
loader plugin.
Args:
@ -130,7 +130,7 @@ class LoaderPlugin(list):
"""
plugin_repre_names = cls.get_representations()
plugin_product_types = cls.families
plugin_product_types = cls.product_types
if (
not plugin_repre_names
or not plugin_product_types

View file

@ -735,7 +735,7 @@ def get_representation_path(representation, root=None):
def is_compatible_loader(Loader, context):
"""Return whether a loader is compatible with a context.
This checks the version's families and the representation for the given
This checks the product type and the representation for the given
Loader.
Returns:

View file

@ -315,9 +315,9 @@ class BuildWorkfile:
).format(json.dumps(profile, indent=4)))
continue
# Check families
profile_families = profile.get("product_types")
if not profile_families:
# Check product types
profile_product_types = profile.get("product_types")
if not profile_product_types:
self.log.warning((
"Build profile is missing families configuration: {0}"
).format(json.dumps(profile, indent=4)))
@ -334,7 +334,8 @@ class BuildWorkfile:
# Prepare lowered families and representation names
profile["product_types_lowered"] = [
fam.lower() for fam in profile_families
product_type.lower()
for product_type in profile_product_types
]
profile["repre_names_lowered"] = [
name.lower() for name in profile_repre_names

View file

@ -1286,14 +1286,14 @@ class PlaceholderLoadMixin(object):
loader_items = list(sorted(loader_items, key=lambda i: i["label"]))
options = options or {}
# Get families from all loaders excluding "*"
families = set()
# Get product types from all loaders excluding "*"
product_types = set()
for loader in loaders_by_name.values():
families.update(loader.families)
families.discard("*")
product_types.update(loader.product_types)
product_types.discard("*")
# Sort for readability
families = list(sorted(families))
product_types = list(sorted(product_types))
builder_type_enum_items = [
{"label": "Current folder", "value": "context_folder"},
@ -1333,7 +1333,7 @@ class PlaceholderLoadMixin(object):
"product_type",
label="Product type",
default=product_type,
items=families
items=product_types
),
attribute_definitions.TextDef(
"representation",