forked from regro/cf-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate_to_hash.py
38 lines (31 loc) · 1.01 KB
/
migrate_to_hash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import networkx as nx
from conda_forge_tick.migrators import Compiler
g = nx.read_gpickle("../cf-graph/graph.pkl")
# Migrate the PRed versions
for node, attrs in g.nodes.items():
if attrs.get("PRed", False):
attrs["PRed"] = [
{
"migrator_name": "Version",
"migrator_version": 0,
"version": attrs["PRed"],
}
]
elif "PRed" in attrs:
attrs["PRed"] = []
# Don't migrate already done Compilers (double commits cause problems)
m = Compiler()
compiler_migrations = []
for node, attrs in g.nodes.items():
if m.filter(attrs):
continue
compiler_migrations.append(node)
last_compiler_pr = "cxxopts"
last_compiler_index = compiler_migrations.index(last_compiler_pr)
for i in range(last_compiler_index):
attrs = g.nodes[compiler_migrations[i]]
attrs.setdefault("PRed", []).append(
{"migrator_name": "Compiler", "migrator_version": 0}
)
nx.write_gpickle(g, "../cf-graph/graph.pkl")