Skip to content

Commit

Permalink
Add support for a migrator to wait for another migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Jun 16, 2021
1 parent bf06fad commit eb18d84
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions conda_forge_tick/migrators/migration_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ def __init__(
self.bump_number = bump_number
print(self.yaml_contents)

def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
loaded_yaml = yaml.safe_load(self.yaml_contents)
wait_for_migrators = loaded_yaml.get("__migrator", {}).get(
"wait_for_migrators",
[],
)
need_to_wait = False
if wait_for_migrators:
done_migrators = []
for migration in attrs.get("PRed", []):
if migration.get("name", "") not in wait_for_migrators:
continue
state = migration.get("PR", {}).get("state", "")
if state != "closed":
need_to_wait = True

return need_to_wait or super().filter(
attrs=attrs,
not_bad_str_start=not_bad_str_start,
)

def migrate(
self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any
) -> "MigrationUidTypedDict":
Expand Down

0 comments on commit eb18d84

Please sign in to comment.