diff --git a/.github/sc4pac-yaml-schema.py b/.github/sc4pac-yaml-schema.py index e2d23775..b73d3ee1 100644 --- a/.github/sc4pac-yaml-schema.py +++ b/.github/sc4pac-yaml-schema.py @@ -51,6 +51,15 @@ "bsc:mega-props-newmaninc-rivers-and-ponds", ]) +# Add packages as necessary. These packages should only be used as dependencies +# from packages with a matching variant. For example, a package without a DN +# variant should never depend on simfox:day-and-nite-mod. +variant_specific_dependencies = { + "simfox:day-and-nite-mod": ("nightmode", "dark"), + "toroca:industry-quadrupler": ("toroca:industry-quadrupler:capacity", "quadrupled"), + "cam:colossus-addon-mod": ("CAM", "yes"), +} + unique_strings = { "type": "array", "items": {"type": "string"}, @@ -206,6 +215,7 @@ def __init__(self): self.packages_using_asset = {} # asset -> set of packages self.dlls_without_checksum = set() self.http_without_checksum = set() + self.unexpected_variant_specific_dependencies = [] # (pkg, dependency) def aggregate_identifiers(self, doc): if 'assetId' in doc: @@ -243,8 +253,14 @@ def iterate_doc_and_variants(): for obj in iterate_doc_and_variants(): local_deps = obj.get('dependencies', []) self.referenced_packages.update(local_deps) - if pkg in local_deps: - self.self_dependencies.add(pkg) + for dep in local_deps: + if dep == pkg: + self.self_dependencies.add(pkg) + if dep in variant_specific_dependencies: + expected_variant, expected_value = variant_specific_dependencies[dep] + if obj.get('variant', {}).get(expected_variant) != expected_value: + self.unexpected_variant_specific_dependencies.append((pkg, dep)) + local_assets = list(asset_ids(obj)) self.referenced_assets.update(local_assets) for a in local_assets: @@ -480,6 +496,8 @@ def basic_report(identifiers, msg: str, stringify=None): for label, dupes in dependency_checker.duplicates().items(): basic_report(dupes, f"The following {label} are defined multiple times:") basic_report(dependency_checker.self_dependencies, "The following packages unnecessarily depend on themselves:") + basic_report(dependency_checker.unexpected_variant_specific_dependencies, "The following packages have dependencies that should only be used with specific variants:", + lambda tup: "{0} depends on {1}, but this dependency should only be used with variant \"{2}={3}\"".format(*(tup + variant_specific_dependencies[tup[1]]))) basic_report(dependency_checker.assets_with_same_url(), "The following assets have the same URL (The same asset was defined twice with different asset IDs):", lambda assets: ', '.join(assets)) diff --git a/src/yaml/andisart/tower-verre-53w53.yaml b/src/yaml/andisart/tower-verre-53w53.yaml index 3dd466b7..f1a471b4 100644 --- a/src/yaml/andisart/tower-verre-53w53.yaml +++ b/src/yaml/andisart/tower-verre-53w53.yaml @@ -1,6 +1,6 @@ group: andisart name: tower-verre -version: "1.0" +version: "1.0-1" subfolder: 360-landmark info: summary: Tower Verre - 53W53 (MoMA Expansion Tower) @@ -27,8 +27,6 @@ info: - https://www.simtropolis.com/objects/screens/monthly_2018_02/closeup.thumb.jpg.a77e5252f67dd1dd2eadcf9adbe0dc30.jpg - https://www.simtropolis.com/objects/screens/monthly_2018_02/logo.thumb.jpg.c5926809b29dd839553292b9dd8c7625.jpg -dependencies: - - simfox:day-and-nite-mod variants: - variant: { nightmode: standard } assets: