diff --git a/conda_forge_tick/feedstock_parser.py b/conda_forge_tick/feedstock_parser.py index 912c030da..d05742080 100644 --- a/conda_forge_tick/feedstock_parser.py +++ b/conda_forge_tick/feedstock_parser.py @@ -305,6 +305,7 @@ def populate_feedstock_attributes( raise LOGGER.debug("platforms: %s", plat_arch) + sub_graph["platforms"] = ["_".join(k) for k in plat_arch] # this makes certain that we have consistent ordering sorted_variant_yamls = [x for _, x in sorted(zip(plat_arch, variant_yamls))] diff --git a/conda_forge_tick/migrators/migration_yaml.py b/conda_forge_tick/migrators/migration_yaml.py index dc8d402e7..cb3ec1d6d 100644 --- a/conda_forge_tick/migrators/migration_yaml.py +++ b/conda_forge_tick/migrators/migration_yaml.py @@ -176,10 +176,23 @@ def __init__( self.max_solver_attempts = max_solver_attempts def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool: - wait_for_migrators = self.loaded_yaml.get("__migrator", {}).get( - "wait_for_migrators", - [], - ) + """ + Determine whether migrator needs to be filtered out. + + Return value of True means to skip migrator, False means to go ahead. + Calls up the MRO until Migrator.filter, see docstring there (./core.py). + """ + migrator_payload = self.loaded_yaml.get("__migrator", {}) + platform_restriction = migrator_payload.get("platform_restriction", []) + wait_for_migrators = migrator_payload.get("wait_for_migrators", []) + + platform_filtered = False + if platform_restriction: + # filter out nodes where the intersection between + # attrs.platforms and platform_restriction is empty + intersection = set(attrs.get("platforms", {})) & set(platform_restriction) + platform_filtered = not bool(intersection) + need_to_wait = False if wait_for_migrators: found_migrators = set() @@ -199,9 +212,13 @@ def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool: wait_for_migrators, ) - return need_to_wait or super().filter( - attrs=attrs, - not_bad_str_start=not_bad_str_start, + return ( + platform_filtered + or need_to_wait + or super().filter( + attrs=attrs, + not_bad_str_start=not_bad_str_start, + ) ) def migrate( diff --git a/conda_forge_tick/migrators_types.pyi b/conda_forge_tick/migrators_types.pyi index f84a036fc..a0005c23d 100644 --- a/conda_forge_tick/migrators_types.pyi +++ b/conda_forge_tick/migrators_types.pyi @@ -111,6 +111,7 @@ class AttrsTypedDict_(TypedDict, total=False): package: PackageTypedDict raw_meta_yaml: str req: Set[str] + platforms: List[str] requirements: RequirementsTypedDict source: SourceTypedDict test: TestTypedDict