sd-card-images/metascripts/rebuild-jekyll-boards

41 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
import csv, os, glob
for x in glob.glob("docs/_boards/*.md"):
os.remove(x)
chips = {}
isa_to_arch = {
"armv7": "armhf",
"armv8": "arm64",
}
with open("chips.csv") as csvfile:
chipsf = csv.reader(csvfile)
next(chipsf)
for row in chipsf:
if not row:
continue
if row[0].strip().startswith("#"):
continue
chips[row[0]] = row
with open("boards.csv") as csvfile:
boardsf = csv.reader(csvfile)
next(boardsf)
for row in boardsf:
if not row:
continue
if row[0].strip().startswith("#"):
continue
with open("docs/_boards/%s.md" % row[0], "w") as boardf:
boardf.write("---\n")
boardf.write("layout: board\n")
boardf.write("title: %s SD card images\n" % (row[1]))
boardf.write("description: \"Debian %s SD card images for %s by %s, SoC: %s %s, CPU ISA: %s\"\n" % (isa_to_arch[chips[row[3]][4]], row[1], row[2], chips[row[3]][2], chips[row[3]][1], chips[row[3]][4]))
boardf.write("board_id: %s\n" % (row[0]))
boardf.write("board_dtb_name: %s\n" % (row[6]))
boardf.write("board_name: %s\n" % (row[1]))
boardf.write("board_maker_name: %s\n" % (row[2]))
boardf.write("board_soc_name: %s %s\n" % (chips[row[3]][2], chips[row[3]][1]))
boardf.write("board_cpu_name: %s (%s)\n" % (chips[row[3]][3], chips[row[3]][4]))
boardf.write("board_cpu_arch_isa: %s\n" % (chips[row[3]][4]))
boardf.write("board_cpu_arch_debian: %s\n" % (isa_to_arch[chips[row[3]][4]]))
boardf.write("---\n")