Update python actions scripts to work with board alias and check board_id exists
This commit is contained in:
parent
23a6c04b6b
commit
82dd2ce5e3
2 changed files with 31 additions and 2 deletions
|
|
@ -10,6 +10,22 @@ with open('template.md', "rt") as f:
|
|||
metadata, content = frontmatter.parse(f.read())
|
||||
acceptable_features = set(metadata['features'])
|
||||
|
||||
def verify_board_id(folder):
|
||||
valid = True
|
||||
for filename in Path(folder).glob("*.md"):
|
||||
with open(filename, "rt") as f:
|
||||
metadata, _ = frontmatter.parse(f.read())
|
||||
downloads_display = metadata.get('downloads_display')
|
||||
if downloads_display is None or downloads_display:
|
||||
board_id = metadata.get('board_id')
|
||||
if board_id == "unknown":
|
||||
continue
|
||||
if not board_id:
|
||||
print(f"board_id should be set for {filename}")
|
||||
valid = False
|
||||
|
||||
return valid
|
||||
|
||||
def valid_date(date):
|
||||
date = str(date)
|
||||
if date:
|
||||
|
|
@ -93,7 +109,7 @@ def verify_contribute_not_present(folder):
|
|||
if not verify_features("_board", acceptable_features):
|
||||
print("Non-standard features found. See https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads for acceptable features")
|
||||
raise SystemExit(True)
|
||||
|
||||
|
||||
# Check Blinka Download Features
|
||||
blinka_features = {
|
||||
"Ethernet",
|
||||
|
|
@ -108,6 +124,14 @@ blinka_features = {
|
|||
"Infrared Receiver",
|
||||
}
|
||||
|
||||
if not verify_board_id("_board"):
|
||||
print("board_id missing for some boards. This is a required field.")
|
||||
raise SystemExit(True)
|
||||
|
||||
if not verify_board_id("_blinka"):
|
||||
print("board_id missing for some boards. This is a required field.")
|
||||
raise SystemExit(True)
|
||||
|
||||
if not verify_features("_blinka", blinka_features):
|
||||
print("Non-standard features found. See https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-blinka for acceptable features")
|
||||
raise SystemExit(True)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@ def main():
|
|||
board_id = metadata.get("board_id").strip() or ()
|
||||
if board_id == "unknown":
|
||||
continue
|
||||
board_alias = metadata.get("board_alias")
|
||||
if not board_alias:
|
||||
board_alias = board_id
|
||||
else:
|
||||
board_alias = board_alias.strip()
|
||||
board["name"] = metadata.get("name").strip()
|
||||
board["chipfamily"] = metadata.get("family").strip()
|
||||
if board["chipfamily"] not in INCLUDED_CHIP_FAMILIES:
|
||||
|
|
@ -70,7 +75,7 @@ def main():
|
|||
board["bootloader"] = get_bootloader(
|
||||
board["chipfamily"], bootloader_id
|
||||
)
|
||||
board["releases"] = get_releases(board_id)
|
||||
board["releases"] = get_releases(board_alias)
|
||||
boards[board_id] = board
|
||||
print(f"Added {board_id}")
|
||||
return boards
|
||||
|
|
|
|||
Loading…
Reference in a new issue