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:
commit
eec42d4cb5
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -30,17 +31,27 @@ import sys
|
||||||
|
|
||||||
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
|
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():
|
def get_shared_bindings():
|
||||||
""" Get a list of modules in shared-bindings based on folder names
|
""" 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():
|
def read_mpconfig():
|
||||||
""" Open 'circuitpy_mpconfig.mk' and return the contents.
|
""" Open 'circuitpy_mpconfig.mk' and return the contents.
|
||||||
"""
|
"""
|
||||||
configs = []
|
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()
|
configs = mpconfig.read()
|
||||||
|
|
||||||
return configs
|
return configs
|
||||||
|
@ -120,7 +131,7 @@ def lookup_setting(settings, key, default=''):
|
||||||
key = value[2:-1]
|
key = value[2:-1]
|
||||||
return value
|
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
|
""" Compiles a list of the available core modules available for each
|
||||||
board.
|
board.
|
||||||
"""
|
"""
|
||||||
|
@ -129,17 +140,19 @@ def support_matrix_by_board():
|
||||||
boards = dict()
|
boards = dict()
|
||||||
for port in SUPPORTED_PORTS:
|
for port in SUPPORTED_PORTS:
|
||||||
|
|
||||||
port_dir = "ports/{}/boards".format(port)
|
port_dir = get_circuitpython_root_dir() / "ports" / port
|
||||||
for entry in os.scandir(port_dir):
|
for entry in (port_dir / "boards").iterdir():
|
||||||
if not entry.is_dir():
|
if not entry.is_dir():
|
||||||
continue
|
continue
|
||||||
board_modules = []
|
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:
|
if use_branded_name:
|
||||||
|
with open(entry / "mpconfigboard.h") as get_name:
|
||||||
board_contents = get_name.read()
|
board_contents = get_name.read()
|
||||||
board_name_re = re.search("(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
|
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
|
||||||
board_contents)
|
board_contents)
|
||||||
if board_name_re:
|
if board_name_re:
|
||||||
board_name = board_name_re.group(1).strip('"')
|
board_name = board_name_re.group(1).strip('"')
|
||||||
|
|
|
@ -9,6 +9,9 @@ import base64
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from sh.contrib import git
|
from sh.contrib import git
|
||||||
|
|
||||||
|
sys.path.append("../docs")
|
||||||
|
import shared_bindings_matrix
|
||||||
|
|
||||||
sys.path.append("adabot")
|
sys.path.append("adabot")
|
||||||
import adabot.github_requests as github
|
import adabot.github_requests as github
|
||||||
|
|
||||||
|
@ -246,6 +249,10 @@ def generate_download_info():
|
||||||
|
|
||||||
languages = get_languages()
|
languages = get_languages()
|
||||||
|
|
||||||
|
support_matrix = shared_bindings_matrix.support_matrix_by_board(
|
||||||
|
use_branded_name=False
|
||||||
|
)
|
||||||
|
|
||||||
new_stable = "-" not in new_tag
|
new_stable = "-" not in new_tag
|
||||||
|
|
||||||
previous_releases = set()
|
previous_releases = set()
|
||||||
|
@ -283,6 +290,7 @@ def generate_download_info():
|
||||||
new_version = {
|
new_version = {
|
||||||
"stable": new_stable,
|
"stable": new_stable,
|
||||||
"version": new_tag,
|
"version": new_tag,
|
||||||
|
"modules": support_matrix.get(alias, "[]"),
|
||||||
"files": {}
|
"files": {}
|
||||||
}
|
}
|
||||||
for language in languages:
|
for language in languages:
|
||||||
|
|
Loading…
Reference in New Issue