Skip to content

Release PRs To circuitpython.org: Include The Available Built-in Modules For Each Board #3087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions docs/shared_bindings_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,35 @@

import json
import os
import pathlib
import re
import subprocess
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
Expand Down Expand Up @@ -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.
"""
Expand All @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions tools/build_board_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
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

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down