master
py 37 lines 817 Bytes
Raw
1 #!/usr/bin/env python3
2
3 import json
4
5 from ruamel.yaml import YAML
6
7 yaml = YAML(typ='safe')
8 entries = []
9
10 with open('.github/data/distros.yml') as f:
11 data = yaml.load(f)
12
13 for i, v in enumerate(data['include']):
14 if v['test'].get('skip-local-build', False):
15 continue
16
17 e = {
18 'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
19 'version': v['version'],
20 }
21
22 if 'base_image' in v:
23 e['distro'] = v['base_image']
24 else:
25 e['distro'] = ':'.join([v['distro'], str(v['version'])])
26
27 if 'env_prep' in v:
28 e['env_prep'] = v['env_prep']
29
30 if 'jsonc_removal' in v:
31 e['jsonc_removal'] = v['jsonc_removal']
32
33 entries.append(e)
34
35 entries.sort(key=lambda k: k['distro'])
36 matrix = json.dumps({'include': entries}, sort_keys=True)
37 print(matrix)