summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-07-02 13:45:39 -0700
committerGitHub <noreply@github.com>2020-07-02 13:45:39 -0700
commiteec42d4cb53536a75e88f7f9321515bc6dcfeaa7 (patch)
tree747313ce9b436cba4217ac1e0e5df9fbcaec6319
parent4a214263776924758dce384401fbc1f93ea39635 (diff)
parentc84c30846cded89bfef889ae3bd92f9102fab816 (diff)
Merge pull request #3087 from sommersoft/cpy_org_sptmtrx
Release PRs To circuitpython.org: Include The Available Built-in Modules For Each Board
-rw-r--r--docs/shared_bindings_matrix.py37
-rw-r--r--tools/build_board_info.py8
2 files changed, 33 insertions, 12 deletions
diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py
index 02ef68349..4abf5b885 100644
--- a/docs/shared_bindings_matrix.py
+++ b/docs/shared_bindings_matrix.py
@@ -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:
diff --git a/tools/build_board_info.py b/tools/build_board_info.py
index 6c670930f..20a5866b7 100644
--- a/tools/build_board_info.py
+++ b/tools/build_board_info.py
@@ -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: