2019-07-04 02:18:16 -04:00
|
|
|
# The MIT License (MIT)
|
|
|
|
#
|
2020-06-03 18:40:05 -04:00
|
|
|
# SPDX-FileCopyrightText: Copyright (c) 2019 Michael Schroeder
|
2019-07-04 02:18:16 -04:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
# THE SOFTWARE.
|
|
|
|
#
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
2020-06-29 01:17:12 -04:00
|
|
|
import pathlib
|
2019-07-04 02:18:16 -04:00
|
|
|
import re
|
2020-05-25 10:37:35 -04:00
|
|
|
import subprocess
|
|
|
|
import sys
|
2022-10-14 12:06:35 -04:00
|
|
|
import functools
|
2019-07-04 02:18:16 -04:00
|
|
|
|
2020-08-26 12:13:18 -04:00
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
2019-07-04 02:18:16 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
SUPPORTED_PORTS = [
|
|
|
|
"atmel-samd",
|
|
|
|
"broadcom",
|
|
|
|
"cxd56",
|
|
|
|
"espressif",
|
|
|
|
"litex",
|
|
|
|
"mimxrt10xx",
|
|
|
|
"nrf",
|
|
|
|
"raspberrypi",
|
2023-04-18 12:42:16 -04:00
|
|
|
"silabs",
|
2023-03-14 16:03:42 -04:00
|
|
|
"stm",
|
|
|
|
]
|
2019-07-04 02:18:16 -04:00
|
|
|
|
2022-07-20 21:08:51 -04:00
|
|
|
ALIASES_BY_BOARD = {
|
2021-03-29 12:14:37 -04:00
|
|
|
"circuitplayground_express": [
|
|
|
|
"circuitplayground_express_4h",
|
|
|
|
"circuitplayground_express_digikey_pycon2019",
|
|
|
|
],
|
|
|
|
"pybadge": ["edgebadge"],
|
|
|
|
"pyportal": ["pyportal_pynt"],
|
|
|
|
"gemma_m0": ["gemma_m0_pycon2018"],
|
|
|
|
}
|
|
|
|
|
2022-07-20 21:08:51 -04:00
|
|
|
ALIASES_BRAND_NAMES = {
|
2023-03-14 16:03:42 -04:00
|
|
|
"circuitplayground_express_4h": "Adafruit Circuit Playground Express 4-H",
|
|
|
|
"circuitplayground_express_digikey_pycon2019": "Circuit Playground Express Digi-Key PyCon 2019",
|
|
|
|
"edgebadge": "Adafruit EdgeBadge",
|
|
|
|
"pyportal_pynt": "Adafruit PyPortal Pynt",
|
|
|
|
"gemma_m0_pycon2018": "Adafruit Gemma M0 PyCon 2018",
|
2021-03-29 12:14:37 -04:00
|
|
|
}
|
|
|
|
|
2022-07-20 21:08:51 -04:00
|
|
|
ADDITIONAL_MODULES = {
|
2022-10-04 19:22:18 -04:00
|
|
|
"_asyncio": "MICROPY_PY_UASYNCIO",
|
2021-03-29 12:14:37 -04:00
|
|
|
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
|
2022-04-16 20:04:03 -04:00
|
|
|
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF",
|
2022-10-04 19:22:18 -04:00
|
|
|
"array": "CIRCUITPY_ARRAY",
|
|
|
|
# always available, so depend on something that's always 1.
|
|
|
|
"builtins": "CIRCUITPY",
|
|
|
|
"collections": "CIRCUITPY_COLLECTIONS",
|
|
|
|
"fontio": "CIRCUITPY_DISPLAYIO",
|
|
|
|
"io": "CIRCUITPY_IO",
|
|
|
|
"select": "MICROPY_PY_USELECT_SELECT",
|
|
|
|
"terminalio": "CIRCUITPY_DISPLAYIO",
|
|
|
|
"sys": "CIRCUITPY_SYS",
|
2022-04-16 20:04:03 -04:00
|
|
|
"usb": "CIRCUITPY_USB_HOST",
|
2021-03-29 12:14:37 -04:00
|
|
|
}
|
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
MODULES_NOT_IN_BINDINGS = [
|
|
|
|
"_asyncio",
|
|
|
|
"array",
|
|
|
|
"binascii",
|
|
|
|
"builtins",
|
|
|
|
"collections",
|
|
|
|
"errno",
|
|
|
|
"json",
|
|
|
|
"re",
|
|
|
|
"select",
|
|
|
|
"sys",
|
|
|
|
"ulab",
|
|
|
|
]
|
2022-10-04 19:22:18 -04:00
|
|
|
|
2022-07-20 21:08:51 -04:00
|
|
|
FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
|
2022-04-16 20:04:03 -04:00
|
|
|
"""Files and dirs at the root of a frozen directory that should be ignored.
|
|
|
|
This is the same list as in the preprocess_frozen_modules script."""
|
|
|
|
|
2022-05-04 04:32:42 -04:00
|
|
|
repository_urls = {}
|
|
|
|
"""Cache of repository URLs for frozen modules."""
|
|
|
|
|
2022-10-14 10:23:35 -04:00
|
|
|
root_dir = pathlib.Path(__file__).resolve().parent.parent
|
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2020-06-29 01:17:12 -04:00
|
|
|
def get_circuitpython_root_dir():
|
2023-03-14 16:03:42 -04:00
|
|
|
"""The path to the root './circuitpython' directory."""
|
2020-06-29 10:02:04 -04:00
|
|
|
return root_dir
|
2020-06-29 01:17:12 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
|
|
|
def get_bindings():
|
|
|
|
"""Get a list of modules in shared-bindings and ports/*/bindings based on folder names."""
|
|
|
|
shared_bindings_modules = [
|
|
|
|
module.name
|
|
|
|
for module in (get_circuitpython_root_dir() / "shared-bindings").iterdir()
|
|
|
|
if module.is_dir()
|
|
|
|
]
|
|
|
|
bindings_modules = []
|
|
|
|
for d in get_circuitpython_root_dir().glob("ports/*/bindings"):
|
|
|
|
bindings_modules.extend(module.name for module in d.iterdir() if d.is_dir())
|
|
|
|
return shared_bindings_modules + bindings_modules + MODULES_NOT_IN_BINDINGS
|
2019-07-04 02:18:16 -04:00
|
|
|
|
|
|
|
|
2022-07-20 21:08:51 -04:00
|
|
|
def get_board_mapping():
|
|
|
|
"""
|
|
|
|
Compiles the list of boards from the directories, with aliases and mapping
|
|
|
|
to the port.
|
|
|
|
"""
|
|
|
|
boards = {}
|
|
|
|
for port in SUPPORTED_PORTS:
|
2022-10-14 10:23:35 -04:00
|
|
|
board_path = root_dir / "ports" / port / "boards"
|
2022-07-20 21:08:51 -04:00
|
|
|
for board_path in os.scandir(board_path):
|
|
|
|
if board_path.is_dir():
|
|
|
|
board_files = os.listdir(board_path.path)
|
|
|
|
board_id = board_path.name
|
|
|
|
aliases = ALIASES_BY_BOARD.get(board_path.name, [])
|
|
|
|
boards[board_id] = {
|
|
|
|
"port": port,
|
|
|
|
"download_count": 0,
|
|
|
|
"aliases": aliases,
|
|
|
|
}
|
|
|
|
for alias in aliases:
|
|
|
|
boards[alias] = {
|
|
|
|
"port": port,
|
|
|
|
"download_count": 0,
|
|
|
|
"alias": True,
|
|
|
|
"aliases": [],
|
|
|
|
}
|
|
|
|
return boards
|
|
|
|
|
|
|
|
|
2019-07-04 02:18:16 -04:00
|
|
|
def read_mpconfig():
|
2023-03-14 16:03:42 -04:00
|
|
|
"""Open 'circuitpy_mpconfig.mk' and return the contents."""
|
2019-07-04 02:18:16 -04:00
|
|
|
configs = []
|
2020-06-29 01:17:12 -04:00
|
|
|
cpy_mpcfg = get_circuitpython_root_dir() / "py" / "circuitpy_mpconfig.mk"
|
|
|
|
with open(cpy_mpcfg) as mpconfig:
|
2019-07-04 02:18:16 -04:00
|
|
|
configs = mpconfig.read()
|
|
|
|
|
|
|
|
return configs
|
|
|
|
|
|
|
|
|
2019-07-27 10:15:37 -04:00
|
|
|
def build_module_map():
|
2023-03-14 16:03:42 -04:00
|
|
|
"""Establish the base of the JSON file, based on the contents from
|
|
|
|
`configs`. Base will contain module names, if they're part of
|
|
|
|
the `FULL_BUILD`, or their default value (0, 1, or a list of
|
|
|
|
modules that determine default [see audiocore, audiomixer, etc.]).
|
2019-07-04 02:18:16 -04:00
|
|
|
|
|
|
|
"""
|
2019-07-23 21:49:37 -04:00
|
|
|
base = dict()
|
2023-03-14 16:03:42 -04:00
|
|
|
modules = get_bindings()
|
2019-07-27 10:15:37 -04:00
|
|
|
configs = read_mpconfig()
|
2019-07-04 02:18:16 -04:00
|
|
|
full_build = False
|
|
|
|
for module in modules:
|
|
|
|
full_name = module
|
2022-07-20 21:08:51 -04:00
|
|
|
if module in ADDITIONAL_MODULES:
|
|
|
|
search_identifier = ADDITIONAL_MODULES[module]
|
2021-03-29 12:14:37 -04:00
|
|
|
else:
|
2023-03-14 16:03:42 -04:00
|
|
|
search_identifier = "CIRCUITPY_" + module.lstrip("_").upper()
|
2021-03-29 12:14:37 -04:00
|
|
|
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
|
2019-09-28 00:41:34 -04:00
|
|
|
find_config = re.findall(re_pattern, configs)
|
2019-07-04 02:18:16 -04:00
|
|
|
if not find_config:
|
|
|
|
continue
|
2019-09-28 00:41:34 -04:00
|
|
|
find_config = ", ".join([x.strip("$()") for x in find_config])
|
|
|
|
|
|
|
|
full_build = int("CIRCUITPY_FULL_BUILD" in find_config)
|
2019-07-04 02:18:16 -04:00
|
|
|
if not full_build:
|
2019-09-28 00:41:34 -04:00
|
|
|
default_val = find_config
|
2019-07-04 02:18:16 -04:00
|
|
|
else:
|
|
|
|
default_val = "None"
|
2019-09-28 00:41:34 -04:00
|
|
|
|
2021-03-29 12:14:37 -04:00
|
|
|
base[module] = {
|
2019-07-04 02:18:16 -04:00
|
|
|
"name": full_name,
|
|
|
|
"full_build": str(full_build),
|
|
|
|
"default_value": default_val,
|
2021-03-29 12:14:37 -04:00
|
|
|
"excluded": {},
|
|
|
|
"key": search_identifier,
|
2019-07-04 02:18:16 -04:00
|
|
|
}
|
|
|
|
|
2019-07-27 10:15:37 -04:00
|
|
|
return base
|
2019-07-04 02:18:16 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2020-05-25 10:37:35 -04:00
|
|
|
def get_settings_from_makefile(port_dir, board_name):
|
2023-03-14 16:03:42 -04:00
|
|
|
"""Invoke make in a mode which prints the database, then parse it for
|
|
|
|
settings.
|
2019-07-04 02:18:16 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
This means that the effect of all Makefile directives is taken
|
|
|
|
into account, without having to re-encode the logic that sets them
|
|
|
|
in this script, something that has proved error-prone
|
2019-07-04 02:18:16 -04:00
|
|
|
"""
|
2020-05-26 10:55:23 -04:00
|
|
|
contents = subprocess.run(
|
2023-03-14 16:03:42 -04:00
|
|
|
["make", "-C", port_dir, f"BOARD={board_name}", "-qp", "print-CC"],
|
|
|
|
encoding="utf-8",
|
|
|
|
errors="replace",
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
)
|
2020-05-25 10:37:35 -04:00
|
|
|
# Make signals errors with exit status 2; 0 and 1 are "non-error" statuses
|
2020-05-26 10:55:23 -04:00
|
|
|
if contents.returncode not in (0, 1):
|
|
|
|
error_msg = (
|
|
|
|
f"Invoking '{' '.join(contents.args)}' exited with "
|
|
|
|
f"{contents.returncode}: {contents.stderr}"
|
|
|
|
)
|
|
|
|
raise RuntimeError(error_msg)
|
|
|
|
|
2020-05-25 10:37:35 -04:00
|
|
|
settings = {}
|
2023-03-14 16:03:42 -04:00
|
|
|
for line in contents.stdout.split("\n"):
|
2021-05-04 18:07:01 -04:00
|
|
|
# Handle both = and := definitions.
|
2023-03-14 16:03:42 -04:00
|
|
|
m = re.match(r"^([A-Z][A-Z0-9_]*) :?= (.*)$", line)
|
2020-05-25 10:37:35 -04:00
|
|
|
if m:
|
|
|
|
settings[m.group(1)] = m.group(2)
|
2020-05-26 10:55:23 -04:00
|
|
|
|
2020-05-25 10:37:35 -04:00
|
|
|
return settings
|
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2022-04-16 20:04:03 -04:00
|
|
|
def get_repository_url(directory):
|
2022-05-04 04:32:42 -04:00
|
|
|
if directory in repository_urls:
|
|
|
|
return repository_urls[directory]
|
|
|
|
readme = None
|
|
|
|
for readme_path in (
|
2023-03-14 16:03:42 -04:00
|
|
|
os.path.join(directory, "README.rst"),
|
|
|
|
os.path.join(os.path.dirname(directory), "README.rst"),
|
|
|
|
):
|
2022-05-04 04:32:42 -04:00
|
|
|
if os.path.exists(readme_path):
|
|
|
|
readme = readme_path
|
|
|
|
break
|
|
|
|
path = None
|
|
|
|
if readme:
|
|
|
|
with open(readme, "r") as fp:
|
|
|
|
for line in fp.readlines():
|
2023-03-14 16:03:42 -04:00
|
|
|
if m := re.match(
|
|
|
|
"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
|
|
|
|
line,
|
|
|
|
):
|
2022-05-04 04:32:42 -04:00
|
|
|
path = m.group(1)
|
|
|
|
break
|
|
|
|
if m := re.search("<(http[^>]+)>", line):
|
|
|
|
path = m.group(1)
|
|
|
|
break
|
|
|
|
if path is None:
|
|
|
|
contents = subprocess.run(
|
|
|
|
["git", "remote", "get-url", "origin"],
|
|
|
|
encoding="utf-8",
|
|
|
|
errors="replace",
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2023-03-14 16:03:42 -04:00
|
|
|
cwd=directory,
|
2022-05-04 04:32:42 -04:00
|
|
|
)
|
|
|
|
path = contents.stdout.strip()
|
|
|
|
repository_urls[directory] = path
|
|
|
|
return path
|
2022-04-16 20:04:03 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2022-07-19 17:35:51 -04:00
|
|
|
def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
|
2022-04-16 20:04:03 -04:00
|
|
|
"""
|
|
|
|
Go through the list of frozen directories and extract the python modules.
|
|
|
|
Paths are of the type:
|
|
|
|
$(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
|
|
|
|
$(TOP)/frozen/circuitpython-stage/meowbit
|
|
|
|
Python modules are at the root of the path, and are python files or directories
|
2022-07-20 21:08:51 -04:00
|
|
|
containing python files. Except the ones in the FROZEN_EXCLUDES list.
|
2022-04-16 20:04:03 -04:00
|
|
|
"""
|
|
|
|
frozen_modules = []
|
|
|
|
for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")):
|
|
|
|
source_dir = get_circuitpython_root_dir() / frozen_path[7:]
|
|
|
|
url_repository = get_repository_url(source_dir)
|
|
|
|
for sub in source_dir.glob("*"):
|
2022-07-20 21:08:51 -04:00
|
|
|
if sub.name in FROZEN_EXCLUDES:
|
2022-04-16 20:04:03 -04:00
|
|
|
continue
|
|
|
|
if sub.name.endswith(".py"):
|
2022-07-19 17:35:51 -04:00
|
|
|
if withurl:
|
|
|
|
frozen_modules.append((sub.name[:-3], url_repository))
|
|
|
|
else:
|
|
|
|
frozen_modules.append(sub.name[:-3])
|
2022-04-16 20:04:03 -04:00
|
|
|
continue
|
2023-03-14 16:03:42 -04:00
|
|
|
if next(sub.glob("**/*.py"), None): # tests if not empty
|
2022-07-19 17:35:51 -04:00
|
|
|
if withurl:
|
|
|
|
frozen_modules.append((sub.name, url_repository))
|
|
|
|
else:
|
|
|
|
frozen_modules.append(sub.name)
|
2022-04-16 20:04:03 -04:00
|
|
|
return frozen_modules
|
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
|
|
|
def lookup_setting(settings, key, default=""):
|
2020-05-25 10:37:35 -04:00
|
|
|
while True:
|
|
|
|
value = settings.get(key, default)
|
2023-03-14 16:03:42 -04:00
|
|
|
if not value.startswith("$"):
|
2020-05-25 10:37:35 -04:00
|
|
|
break
|
|
|
|
key = value[2:-1]
|
|
|
|
return value
|
2019-07-27 10:15:37 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2022-10-14 12:06:35 -04:00
|
|
|
@functools.cache
|
2020-08-26 12:13:18 -04:00
|
|
|
def all_ports_all_boards(ports=SUPPORTED_PORTS):
|
|
|
|
for port in ports:
|
|
|
|
port_dir = get_circuitpython_root_dir() / "ports" / port
|
|
|
|
for entry in (port_dir / "boards").iterdir():
|
|
|
|
if not entry.is_dir():
|
|
|
|
continue
|
|
|
|
yield (port, entry)
|
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
2022-07-19 17:35:51 -04:00
|
|
|
def support_matrix_by_board(use_branded_name=True, withurl=True):
|
2023-03-14 16:03:42 -04:00
|
|
|
"""Compiles a list of the available core modules available for each
|
|
|
|
board.
|
2019-07-27 10:15:37 -04:00
|
|
|
"""
|
|
|
|
base = build_module_map()
|
|
|
|
|
2020-08-26 12:13:18 -04:00
|
|
|
def support_matrix(arg):
|
|
|
|
port, entry = arg
|
2020-06-29 01:17:12 -04:00
|
|
|
port_dir = get_circuitpython_root_dir() / "ports" / port
|
2020-08-26 12:13:18 -04:00
|
|
|
settings = get_settings_from_makefile(str(port_dir), entry.name)
|
|
|
|
|
|
|
|
if use_branded_name:
|
|
|
|
with open(entry / "mpconfigboard.h") as get_name:
|
|
|
|
board_contents = get_name.read()
|
2023-03-14 16:03:42 -04:00
|
|
|
board_name_re = re.search(
|
|
|
|
r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)", board_contents
|
|
|
|
)
|
2020-08-26 12:13:18 -04:00
|
|
|
if board_name_re:
|
|
|
|
board_name = board_name_re.group(1).strip('"')
|
2020-08-29 08:37:00 -04:00
|
|
|
else:
|
|
|
|
board_name = entry.name
|
2020-08-26 12:13:18 -04:00
|
|
|
|
|
|
|
board_modules = []
|
|
|
|
for module in base:
|
2023-03-14 16:03:42 -04:00
|
|
|
key = base[module]["key"]
|
|
|
|
if int(lookup_setting(settings, key, "0")):
|
|
|
|
board_modules.append(base[module]["name"])
|
2021-03-29 12:14:37 -04:00
|
|
|
board_modules.sort()
|
|
|
|
|
2022-05-13 05:38:03 -04:00
|
|
|
if "CIRCUITPY_BUILD_EXTENSIONS" in settings:
|
2022-07-20 21:08:51 -04:00
|
|
|
board_extensions = [
|
2023-03-14 16:03:42 -04:00
|
|
|
extension.strip()
|
|
|
|
for extension in settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
|
2022-07-20 21:08:51 -04:00
|
|
|
]
|
2022-05-13 05:38:03 -04:00
|
|
|
else:
|
2022-07-19 17:35:51 -04:00
|
|
|
raise OSError(f"Board extensions undefined: {board_name}.")
|
2022-05-13 05:38:03 -04:00
|
|
|
|
2022-04-16 20:04:03 -04:00
|
|
|
frozen_modules = []
|
|
|
|
if "FROZEN_MPY_DIRS" in settings:
|
2023-03-14 16:03:42 -04:00
|
|
|
frozen_modules = frozen_modules_from_dirs(
|
|
|
|
settings["FROZEN_MPY_DIRS"], withurl
|
|
|
|
)
|
2022-04-16 20:04:03 -04:00
|
|
|
if frozen_modules:
|
|
|
|
frozen_modules.sort()
|
|
|
|
|
2021-03-29 12:14:37 -04:00
|
|
|
# generate alias boards too
|
2023-03-14 16:03:42 -04:00
|
|
|
board_matrix = [
|
|
|
|
(
|
|
|
|
board_name,
|
|
|
|
{
|
|
|
|
"modules": board_modules,
|
|
|
|
"frozen_libraries": frozen_modules,
|
|
|
|
"extensions": board_extensions,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
]
|
2022-07-20 21:08:51 -04:00
|
|
|
if entry.name in ALIASES_BY_BOARD:
|
|
|
|
for alias in ALIASES_BY_BOARD[entry.name]:
|
2021-03-29 12:14:37 -04:00
|
|
|
if use_branded_name:
|
2022-07-20 21:08:51 -04:00
|
|
|
if alias in ALIASES_BRAND_NAMES:
|
|
|
|
alias = ALIASES_BRAND_NAMES[alias]
|
2021-03-29 12:14:37 -04:00
|
|
|
else:
|
2023-03-14 16:03:42 -04:00
|
|
|
alias = alias.replace("_", " ").title()
|
|
|
|
board_matrix.append(
|
|
|
|
(
|
|
|
|
alias,
|
|
|
|
{
|
|
|
|
"modules": board_modules,
|
|
|
|
"frozen_libraries": frozen_modules,
|
|
|
|
"extensions": board_extensions,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
return board_matrix # this is now a list of (board,modules)
|
2020-08-26 12:13:18 -04:00
|
|
|
|
|
|
|
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
|
2021-03-29 12:14:37 -04:00
|
|
|
mapped_exec = executor.map(support_matrix, all_ports_all_boards())
|
|
|
|
# flatmap with comprehensions
|
2023-03-14 16:03:42 -04:00
|
|
|
boards = dict(
|
|
|
|
sorted(
|
|
|
|
[board for matrix in mapped_exec for board in matrix], key=lambda x: x[0]
|
|
|
|
)
|
|
|
|
)
|
2019-07-27 10:15:37 -04:00
|
|
|
|
|
|
|
return boards
|
2020-05-25 10:37:35 -04:00
|
|
|
|
2023-03-14 16:03:42 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2020-05-25 10:37:35 -04:00
|
|
|
print(json.dumps(support_matrix_by_board(), indent=2))
|