From f1256c0b35d8ff3e1893bd345a6ff29c2ee2e752 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 4 Jul 2019 01:18:16 -0500 Subject: add script to gather module support matrix info; add initial json file --- docs/shared_bindings_matrix.py | 130 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 docs/shared_bindings_matrix.py (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py new file mode 100644 index 000000000..ebcadb7ad --- /dev/null +++ b/docs/shared_bindings_matrix.py @@ -0,0 +1,130 @@ +# The MIT License (MIT) +# +# Copyright (c) 2019 Michael Schroeder +# +# 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 +import re + + +SUPPORTED_PORTS = ["atmel-samd", "nrf"] + + +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")] + + +def read_mpconfig(): + """ Open 'circuitpy_mpconfig.mk' and return the contents. + """ + configs = [] + with open("py/circuitpy_mpconfig.mk") as mpconfig: + configs = mpconfig.read() + + return configs + + +def build_json(modules, configs): + """ 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). + + """ + base_json = dict() + full_build = False + for module in modules: + full_name = module + search_name = module.lstrip("_") + re_pattern = "CIRCUITPY_{}\s=\s(.+)".format(search_name.upper()) + find_config = re.search(re_pattern, configs) + #print(module, "|", find_config) + if not find_config: + continue + full_build = int("FULL_BUILD" in find_config[0]) + #print(find_config[1]) + if not full_build: + default_val = find_config[1] + else: + default_val = "None" + base_json[search_name] = { + "name": full_name, + "full_build": str(full_build), + "default_value": default_val, + "excluded": [] + } + + return get_excluded_boards(base_json) + + +def get_excluded_boards(base_json): + """ Cycles through each board's `mpconfigboard.mk` file to determine + if each module is included or not. Boards are selected by existence + in a port listed in `SUPPORTED_PORTS` (e.g. `/port/nrf/feather_52840`) + """ + modules = list(base_json.keys()) + for port in SUPPORTED_PORTS: + port_dir = "ports/{}/boards".format(port) + with os.scandir(port_dir) as boards: + for entry in boards: + if not entry.is_dir(): + continue + contents = "" + board_dir = os.path.join(entry.path, "mpconfigboard.mk") + #print(board_dir) + with open(board_dir) as board: + contents = board.read() + for module in modules: + # check if board uses `SMALL_BUILD`. if yes, and current + # module is marked as `FULL_BUILD`, board is excluded + small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) + if small_build and base_json[module]["full_build"] == "1": + base_json[module]["excluded"].append(entry.name) + continue + + # check if module is specifically disabled for this board + re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper()) + find_module = re.search(re_pattern, contents) + if not find_module: + continue + if (find_module[1] == "0" and + find_module[1] != base_json[module]["default_value"]): + base_json[module]["excluded"].append(entry.name) + + return base_json + +if __name__ == "__main__": + modules = get_shared_bindings() + configs = read_mpconfig() + base = build_json(sorted(modules), configs) + + final_json = json.dumps(base, indent=2) + + shared_bindings_json = 'support_matrix.json' + if 'TRAVIS' in os.environ: + shared_bindings_json = os.path.join('$HOME', shared_bindings_json) + else: + print(final_json) + shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) + with open(shared_bindings_json, "w") as matrix: + json.dump(base, matrix, indent=2) -- cgit v1.2.3 From 42ed84141ebdf821131bd477700e399f4fa76c98 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 4 Jul 2019 01:49:40 -0500 Subject: fix late-night directory snafu --- conf.py | 2 +- docs/shared_bindings_matrix.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/conf.py b/conf.py index 3bc7d2764..152c718b5 100644 --- a/conf.py +++ b/conf.py @@ -31,7 +31,7 @@ master_doc = 'docs/index' # in 'shared-bindings/index.rst' shared_bindings_json = 'support_matrix.json' if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join('$HOME', shared_bindings_json) + shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) else: shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) with open(shared_bindings_json) as json_file: diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index ebcadb7ad..5d7ada701 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -122,7 +122,7 @@ if __name__ == "__main__": shared_bindings_json = 'support_matrix.json' if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join('$HOME', shared_bindings_json) + shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) else: print(final_json) shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) -- cgit v1.2.3 From 7378744bb2357c9b949fc3b74a9dfbb4b7cdb85e Mon Sep 17 00:00:00 2001 From: sommersoft Date: Fri, 5 Jul 2019 16:11:19 -0500 Subject: update regex module use to be python3.5 compatible --- docs/shared_bindings_matrix.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 5d7ada701..f0942b426 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -61,10 +61,10 @@ def build_json(modules, configs): #print(module, "|", find_config) if not find_config: continue - full_build = int("FULL_BUILD" in find_config[0]) + full_build = int("FULL_BUILD" in find_config.group(0)) #print(find_config[1]) if not full_build: - default_val = find_config[1] + default_val = find_config.group(1) else: default_val = "None" base_json[search_name] = { @@ -107,8 +107,8 @@ def get_excluded_boards(base_json): find_module = re.search(re_pattern, contents) if not find_module: continue - if (find_module[1] == "0" and - find_module[1] != base_json[module]["default_value"]): + if (find_module.group(1) == "0" and + find_module.group(1) != base_json[module]["default_value"]): base_json[module]["excluded"].append(entry.name) return base_json -- cgit v1.2.3 From 86e885c5fc1d22217da56d9a0d29b798f95bb99d Mon Sep 17 00:00:00 2001 From: sommersoft Date: Fri, 5 Jul 2019 18:00:26 -0500 Subject: handle module exclusion when the default is to not include a module --- docs/shared_bindings_matrix.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index f0942b426..8aa517129 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -106,6 +106,10 @@ def get_excluded_boards(base_json): re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper()) find_module = re.search(re_pattern, contents) if not find_module: + # check if default inclusion is off ('0'). if the board doesn't + # have it explicitly enabled, its excluded. + if base_json[module]["default_value"] == "0": + base_json[module]["excluded"].append(entry.name) continue if (find_module.group(1) == "0" and find_module.group(1) != base_json[module]["default_value"]): -- cgit v1.2.3 From fce1efc74c0397447a79c94701b9f17cc9038d91 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 7 Jul 2019 09:14:46 -0500 Subject: more python3.5 compatibility fixes --- docs/shared_bindings_matrix.py | 53 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 8aa517129..d690e4718 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -85,35 +85,34 @@ def get_excluded_boards(base_json): modules = list(base_json.keys()) for port in SUPPORTED_PORTS: port_dir = "ports/{}/boards".format(port) - with os.scandir(port_dir) as boards: - for entry in boards: - if not entry.is_dir(): + for entry in os.scandir(port_dir): + if not entry.is_dir(): + continue + contents = "" + board_dir = os.path.join(entry.path, "mpconfigboard.mk") + #print(board_dir) + with open(board_dir) as board: + contents = board.read() + for module in modules: + # check if board uses `SMALL_BUILD`. if yes, and current + # module is marked as `FULL_BUILD`, board is excluded + small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) + if small_build and base_json[module]["full_build"] == "1": + base_json[module]["excluded"].append(entry.name) continue - contents = "" - board_dir = os.path.join(entry.path, "mpconfigboard.mk") - #print(board_dir) - with open(board_dir) as board: - contents = board.read() - for module in modules: - # check if board uses `SMALL_BUILD`. if yes, and current - # module is marked as `FULL_BUILD`, board is excluded - small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) - if small_build and base_json[module]["full_build"] == "1": + + # check if module is specifically disabled for this board + re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper()) + find_module = re.search(re_pattern, contents) + if not find_module: + # check if default inclusion is off ('0'). if the board doesn't + # have it explicitly enabled, its excluded. + if base_json[module]["default_value"] == "0": + base_json[module]["excluded"].append(entry.name) + continue + if (find_module.group(1) == "0" and + find_module.group(1) != base_json[module]["default_value"]): base_json[module]["excluded"].append(entry.name) - continue - - # check if module is specifically disabled for this board - re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper()) - find_module = re.search(re_pattern, contents) - if not find_module: - # check if default inclusion is off ('0'). if the board doesn't - # have it explicitly enabled, its excluded. - if base_json[module]["default_value"] == "0": - base_json[module]["excluded"].append(entry.name) - continue - if (find_module.group(1) == "0" and - find_module.group(1) != base_json[module]["default_value"]): - base_json[module]["excluded"].append(entry.name) return base_json -- cgit v1.2.3 From b90b63bb2bb27597f87173f10451980c4412757f Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 23 Jul 2019 20:49:37 -0500 Subject: don't use files to pass data; call and return directly in conf.py --- conf.py | 12 +++++------- docs/shared_bindings_matrix.py | 44 +++++++++++++++++------------------------- 2 files changed, 23 insertions(+), 33 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/conf.py b/conf.py index 152c718b5..0c23028ec 100644 --- a/conf.py +++ b/conf.py @@ -25,17 +25,15 @@ from recommonmark.parser import CommonMarkParser sys.path.insert(0, os.path.abspath('docs')) sys.path.insert(0, os.path.abspath('.')) +import shared_bindings_matrix + master_doc = 'docs/index' # Grab the JSON values to use while building the module support matrix # in 'shared-bindings/index.rst' -shared_bindings_json = 'support_matrix.json' -if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) -else: - shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) -with open(shared_bindings_json) as json_file: - modules_support_matrix = json.load(json_file) + +modules_support_matrix = shared_bindings_matrix.support_matrix() + html_context = { 'support_matrix': modules_support_matrix } diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index d690e4718..59b67b7b2 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -45,13 +45,13 @@ def read_mpconfig(): return configs -def build_json(modules, configs): +def build_module_map(modules, configs): """ 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). """ - base_json = dict() + base = dict() full_build = False for module in modules: full_name = module @@ -67,22 +67,22 @@ def build_json(modules, configs): default_val = find_config.group(1) else: default_val = "None" - base_json[search_name] = { + base[search_name] = { "name": full_name, "full_build": str(full_build), "default_value": default_val, "excluded": [] } - return get_excluded_boards(base_json) + return get_excluded_boards(base) -def get_excluded_boards(base_json): +def get_excluded_boards(base): """ Cycles through each board's `mpconfigboard.mk` file to determine if each module is included or not. Boards are selected by existence in a port listed in `SUPPORTED_PORTS` (e.g. `/port/nrf/feather_52840`) """ - modules = list(base_json.keys()) + modules = list(base.keys()) for port in SUPPORTED_PORTS: port_dir = "ports/{}/boards".format(port) for entry in os.scandir(port_dir): @@ -97,8 +97,8 @@ def get_excluded_boards(base_json): # check if board uses `SMALL_BUILD`. if yes, and current # module is marked as `FULL_BUILD`, board is excluded small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) - if small_build and base_json[module]["full_build"] == "1": - base_json[module]["excluded"].append(entry.name) + if small_build and base[module]["full_build"] == "1": + base[module]["excluded"].append(entry.name) continue # check if module is specifically disabled for this board @@ -107,27 +107,19 @@ def get_excluded_boards(base_json): if not find_module: # check if default inclusion is off ('0'). if the board doesn't # have it explicitly enabled, its excluded. - if base_json[module]["default_value"] == "0": - base_json[module]["excluded"].append(entry.name) + if base[module]["default_value"] == "0": + base[module]["excluded"].append(entry.name) continue if (find_module.group(1) == "0" and - find_module.group(1) != base_json[module]["default_value"]): - base_json[module]["excluded"].append(entry.name) + find_module.group(1) != base[module]["default_value"]): + base[module]["excluded"].append(entry.name) - return base_json + return base -if __name__ == "__main__": + +def support_matrix(): modules = get_shared_bindings() configs = read_mpconfig() - base = build_json(sorted(modules), configs) - - final_json = json.dumps(base, indent=2) - - shared_bindings_json = 'support_matrix.json' - if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) - else: - print(final_json) - shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) - with open(shared_bindings_json, "w") as matrix: - json.dump(base, matrix, indent=2) + base = build_module_map(sorted(modules), configs) + + return base -- cgit v1.2.3 From a184380dc9a01a88ecb3735d5fbf48e955f2546f Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 27 Jul 2019 09:15:37 -0500 Subject: add port-wide config parsing; add modules-by-board function --- docs/shared_bindings_matrix.py | 148 +++++++++++++++++++++++++++++++++++------ 1 file changed, 128 insertions(+), 20 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 59b67b7b2..694a60942 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -29,6 +29,45 @@ import re SUPPORTED_PORTS = ["atmel-samd", "nrf"] +def parse_port_config(contents, chip_keyword=None): + """ Compile a dictionary of port-wide module configs, which may + be categorized by chipset. + """ + chip_fam = "all" + ifeq_found = False + port_config_results = {"all": []} + + chip_pattern = "" + if chip_keyword: + chip_pattern = ( + re.compile("(?<=ifeq\s\(\$\({}\)\,)(\w+)".format(chip_keyword)) + ) + + for line in contents: + if chip_keyword: + if not ifeq_found: + check_ifeq = chip_pattern.search(line) + if check_ifeq: + ifeq_found = True + chip_fam = check_ifeq.group(1) + print("found chip:", chip_fam) + else: + ifeq_found = False + chip_fam = "all" + else: + if "endif" in line: + ifeq_found = False + chip_fam = "all" + + if "CIRCUITPY_" in line: + if chip_fam in port_config_results: + port_config_results[chip_fam].append(line.rstrip("\n")) + else: + port_config_results[chip_fam] = [line.rstrip("\n")] + + #print(port_config_results) + return port_config_results + def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names """ @@ -45,13 +84,15 @@ def read_mpconfig(): return configs -def build_module_map(modules, configs): +def build_module_map(): """ 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). """ base = dict() + modules = get_shared_bindings() + configs = read_mpconfig() full_build = False for module in modules: full_name = module @@ -71,36 +112,67 @@ def build_module_map(modules, configs): "name": full_name, "full_build": str(full_build), "default_value": default_val, - "excluded": [] + "excluded": {} } - return get_excluded_boards(base) + return base def get_excluded_boards(base): """ Cycles through each board's `mpconfigboard.mk` file to determine if each module is included or not. Boards are selected by existence in a port listed in `SUPPORTED_PORTS` (e.g. `/port/nrf/feather_52840`) + + Boards are further categorized by their respective chipset (SAMD21, + SAMD51, nRF52840, etc.) """ modules = list(base.keys()) + + re_board_chip = None + chip_keyword = None for port in SUPPORTED_PORTS: - port_dir = "ports/{}/boards".format(port) - for entry in os.scandir(port_dir): + # each port appears to use its own define for the chipset + if port in ["atmel-samd"]: + re_board_chip = re.compile("CHIP_FAMILY\s=\s(\w+)") + chip_keyword = "CHIP_FAMILY" + elif port in ["nrf"]: + re_board_chip = re.compile("MCU_VARIANT\s=\s(\w+)") + + port_dir = "ports/{}".format(port) + + port_config_contents = "" + with open(os.path.join(port_dir, "mpconfigport.mk")) as port_config: + port_config_contents = port_config.readlines() + port_config = parse_port_config(port_config_contents, chip_keyword) + + for entry in os.scandir(os.path.join(port_dir, "boards")): if not entry.is_dir(): continue + contents = "" board_dir = os.path.join(entry.path, "mpconfigboard.mk") - #print(board_dir) with open(board_dir) as board: contents = board.read() + + board_chip = re_board_chip.search(contents) + #print(entry.name, board_chip.group(1)) + if not board_chip: + board_chip = "Unknown Chip" + else: + board_chip = board_chip.group(1) + + # add port_config results to contents + contents += "\n" + "\n".join(port_config["all"]) + if board_chip in port_config: + contents += "\n" + "\n".join(port_config[board_chip]) + for module in modules: + board_is_excluded = False # check if board uses `SMALL_BUILD`. if yes, and current # module is marked as `FULL_BUILD`, board is excluded small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) if small_build and base[module]["full_build"] == "1": - base[module]["excluded"].append(entry.name) - continue - + board_is_excluded = True # check if module is specifically disabled for this board re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper()) find_module = re.search(re_pattern, contents) @@ -108,18 +180,54 @@ def get_excluded_boards(base): # check if default inclusion is off ('0'). if the board doesn't # have it explicitly enabled, its excluded. if base[module]["default_value"] == "0": - base[module]["excluded"].append(entry.name) - continue - if (find_module.group(1) == "0" and - find_module.group(1) != base[module]["default_value"]): - base[module]["excluded"].append(entry.name) - + board_is_excluded = True + else: + if (find_module.group(1) == "0" and + find_module.group(1) != base[module]["default_value"]): + board_is_excluded = True + + if board_is_excluded: + if board_chip in base[module]["excluded"]: + base[module]["excluded"][board_chip].append(entry.name) + else: + base[module]["excluded"][board_chip] = [entry.name] + #print(json.dumps(base, indent=2)) return base -def support_matrix(): - modules = get_shared_bindings() - configs = read_mpconfig() - base = build_module_map(sorted(modules), configs) +def support_matrix_excluded_boards(): + """ Compiles a list of available modules, and which board definitions + do not include them. + """ + base = build_module_map() - return base + return get_excluded_boards(base) + +def support_matrix_by_board(): + """ Compiles a list of the available core modules available for each + board. + """ + base = build_module_map() + base_with_exclusions = get_excluded_boards(base) + + boards = dict() + for port in SUPPORTED_PORTS: + port_dir = "ports/{}/boards".format(port) + for entry in os.scandir(port_dir): + if not entry.is_dir(): + continue + board_modules = [] + for module in base_with_exclusions.keys(): + #print(module) + board_has_module = True + if base_with_exclusions[module]["excluded"]: + for port in base_with_exclusions[module]["excluded"].values(): + #print(port) + if entry.name in port: + board_has_module = False + + if board_has_module: + board_modules.append(base_with_exclusions[module]["name"]) + boards[entry.name] = sorted(board_modules) + + return boards -- cgit v1.2.3 From 69bbdcab91e9aec0715be23633551d15e9a55c9e Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 27 Jul 2019 10:30:57 -0500 Subject: use MICROPY_HW_BOARD_NAME vice board's folder name --- docs/shared_bindings_matrix.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 694a60942..c3ca0258f 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -50,7 +50,7 @@ def parse_port_config(contents, chip_keyword=None): if check_ifeq: ifeq_found = True chip_fam = check_ifeq.group(1) - print("found chip:", chip_fam) + #print("found chip:", chip_fam) else: ifeq_found = False chip_fam = "all" @@ -217,17 +217,28 @@ def support_matrix_by_board(): if not entry.is_dir(): continue board_modules = [] + + board_name = entry.name + board_contents = "" + 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('"') + for module in base_with_exclusions.keys(): #print(module) board_has_module = True if base_with_exclusions[module]["excluded"]: for port in base_with_exclusions[module]["excluded"].values(): #print(port) - if entry.name in port: + if board_name in port: board_has_module = False if board_has_module: board_modules.append(base_with_exclusions[module]["name"]) - boards[entry.name] = sorted(board_modules) + boards[board_name] = sorted(board_modules) + #print(json.dumps(boards, indent=2)) return boards -- cgit v1.2.3 From 143275db044ae8a3f1d5aebb5b4c7ddfe49e4d69 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 27 Jul 2019 11:01:10 -0500 Subject: fix board_exclusion lookup --- docs/shared_bindings_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/shared_bindings_matrix.py') diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index c3ca0258f..ed88efc75 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -233,7 +233,7 @@ def support_matrix_by_board(): if base_with_exclusions[module]["excluded"]: for port in base_with_exclusions[module]["excluded"].values(): #print(port) - if board_name in port: + if entry.name in port: board_has_module = False if board_has_module: -- cgit v1.2.3