Merge pull request #3087 from sommersoft/cpy_org_sptmtrx

Release PRs To circuitpython.org: Include The Available Built-in Modules For Each Board
This commit is contained in:
Scott Shawcroft 2020-07-02 13:45:39 -07:00 committed by GitHub
commit eec42d4cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 12 deletions

View File

@ -23,6 +23,7 @@
import json
import os
import pathlib
import re
import subprocess
import sys
@ -30,17 +31,27 @@ import sys
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
def get_circuitpython_root_dir():
""" The path to the root './circuitpython' directory
"""
file_path = pathlib.Path(__file__).resolve()
root_dir = file_path.parent.parent
return root_dir
def get_shared_bindings():
""" Get a list of modules in shared-bindings based on folder names
"""
return [item for item in os.listdir("./shared-bindings")]
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
return [item.name for item in shared_bindings_dir.iterdir()]
def read_mpconfig():
""" Open 'circuitpy_mpconfig.mk' and return the contents.
"""
configs = []
with open("py/circuitpy_mpconfig.mk") as mpconfig:
cpy_mpcfg = get_circuitpython_root_dir() / "py" / "circuitpy_mpconfig.mk"
with open(cpy_mpcfg) as mpconfig:
configs = mpconfig.read()
return configs
@ -120,7 +131,7 @@ def lookup_setting(settings, key, default=''):
key = value[2:-1]
return value
def support_matrix_by_board():
def support_matrix_by_board(use_branded_name=True):
""" Compiles a list of the available core modules available for each
board.
"""
@ -129,20 +140,22 @@ def support_matrix_by_board():
boards = dict()
for port in SUPPORTED_PORTS:
port_dir = "ports/{}/boards".format(port)
for entry in os.scandir(port_dir):
port_dir = get_circuitpython_root_dir() / "ports" / port
for entry in (port_dir / "boards").iterdir():
if not entry.is_dir():
continue
board_modules = []
board_name = entry.name
settings = get_settings_from_makefile(f'ports/{port}', entry.name)
settings = get_settings_from_makefile(str(port_dir), entry.name)
with open(os.path.join(entry.path, "mpconfigboard.h")) as get_name:
board_contents = get_name.read()
board_name_re = re.search("(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
board_contents)
if board_name_re:
board_name = board_name_re.group(1).strip('"')
if use_branded_name:
with open(entry / "mpconfigboard.h") as get_name:
board_contents = get_name.read()
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
board_contents)
if board_name_re:
board_name = board_name_re.group(1).strip('"')
board_modules = []
for module in base:

View File

@ -9,6 +9,9 @@ import base64
from datetime import date
from sh.contrib import git
sys.path.append("../docs")
import shared_bindings_matrix
sys.path.append("adabot")
import adabot.github_requests as github
@ -246,6 +249,10 @@ def generate_download_info():
languages = get_languages()
support_matrix = shared_bindings_matrix.support_matrix_by_board(
use_branded_name=False
)
new_stable = "-" not in new_tag
previous_releases = set()
@ -283,6 +290,7 @@ def generate_download_info():
new_version = {
"stable": new_stable,
"version": new_tag,
"modules": support_matrix.get(alias, "[]"),
"files": {}
}
for language in languages: