meshtastic-firmware/bin/generate_ci_matrix.py

39 wiersze
1.1 KiB
Python
Czysty Zwykły widok Historia

#!/usr/bin/env python
"""Generate the CI matrix"""
2023-04-12 08:06:04 +00:00
import configparser
import json
import os
import sys
2023-04-12 08:06:04 +00:00
rootdir = "variants/"
options = sys.argv[1:]
2023-04-12 08:06:04 +00:00
outlist = []
if len(options) < 1:
print(json.dumps(outlist))
exit()
for subdir, dirs, files in os.walk(rootdir):
for file in files:
2023-04-12 08:06:04 +00:00
if file == "platformio.ini":
config = configparser.ConfigParser()
2023-04-12 08:06:04 +00:00
config.read(subdir + "/" + file)
for c in config.sections():
2023-04-12 08:06:04 +00:00
if c.startswith("env:"):
section = config[c].name[4:]
2023-04-12 08:06:04 +00:00
if "extends" in config[config[c].name]:
if config[config[c].name]["extends"] == options[0] + "_base":
if "board_level" in config[config[c].name]:
if (
config[config[c].name]["board_level"] == "extra"
) & ("extra" in options):
outlist.append(section)
else:
outlist.append(section)
2023-04-12 08:06:04 +00:00
print(json.dumps(outlist))