Skip to content

Commit dfe465c

Browse files
committed
list extensions instead of macros names ("bin,uf2" not BIN_UF2)
the modules_support_matrix usees a dictionnary per board instead of a list optionally include the frozen modules URLs in it
1 parent 21b6daa commit dfe465c

File tree

32 files changed

+67
-66
lines changed

32 files changed

+67
-66
lines changed

conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def _format_args(args_info, include_annotations=True, ignore_self=None):
7171
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
7272
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
7373
modules_support_matrix_reverse = defaultdict(list)
74-
for board, modules in modules_support_matrix.items():
75-
for module in modules[0]:
74+
for board, matrix_info in modules_support_matrix.items():
75+
for module in matrix_info["modules"]:
7676
modules_support_matrix_reverse[module].append(board)
7777

7878
modules_support_matrix_reverse = dict(

docs/shared_bindings_matrix.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def get_repository_url(directory):
204204
repository_urls[directory] = path
205205
return path
206206

207-
def frozen_modules_from_dirs(frozen_mpy_dirs):
207+
def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
208208
"""
209209
Go through the list of frozen directories and extract the python modules.
210210
Paths are of the type:
@@ -221,10 +221,16 @@ def frozen_modules_from_dirs(frozen_mpy_dirs):
221221
if sub.name in frozen_excludes:
222222
continue
223223
if sub.name.endswith(".py"):
224-
frozen_modules.append((sub.name[:-3], url_repository))
224+
if withurl:
225+
frozen_modules.append((sub.name[:-3], url_repository))
226+
else:
227+
frozen_modules.append(sub.name[:-3])
225228
continue
226229
if next(sub.glob("**/*.py"), None): # tests if not empty
227-
frozen_modules.append((sub.name, url_repository))
230+
if withurl:
231+
frozen_modules.append((sub.name, url_repository))
232+
else:
233+
frozen_modules.append(sub.name)
228234
return frozen_modules
229235

230236
def lookup_setting(settings, key, default=''):
@@ -244,7 +250,7 @@ def all_ports_all_boards(ports=SUPPORTED_PORTS):
244250
continue
245251
yield (port, entry)
246252

247-
def support_matrix_by_board(use_branded_name=True):
253+
def support_matrix_by_board(use_branded_name=True, withurl=True):
248254
""" Compiles a list of the available core modules available for each
249255
board.
250256
"""
@@ -275,17 +281,21 @@ def support_matrix(arg):
275281
if "CIRCUITPY_BUILD_EXTENSIONS" in settings:
276282
board_extensions = settings["CIRCUITPY_BUILD_EXTENSIONS"]
277283
else:
278-
raise "Board extensions undefined."
284+
raise OSError(f"Board extensions undefined: {board_name}.")
279285

280286
frozen_modules = []
281287
if "FROZEN_MPY_DIRS" in settings:
282-
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"])
288+
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"], withurl)
283289
if frozen_modules:
284290
frozen_modules.sort()
285291

286292
# generate alias boards too
287293
board_matrix = [(
288-
board_name, (board_modules, frozen_modules, board_extensions)
294+
board_name, {
295+
"modules": board_modules,
296+
"frozen_libraries": frozen_modules,
297+
"extensions": board_extensions,
298+
}
289299
)]
290300
if entry.name in aliases_by_board:
291301
for alias in aliases_by_board[entry.name]:
@@ -295,15 +305,19 @@ def support_matrix(arg):
295305
else:
296306
alias = alias.replace("_"," ").title()
297307
board_matrix.append((
298-
alias, (board_modules, frozen_modules, board_extensions),
308+
alias, {
309+
"modules": board_modules,
310+
"frozen_libraries": frozen_modules,
311+
"extensions": board_extensions,
312+
},
299313
))
300314

301315
return board_matrix # this is now a list of (board,modules)
302316

303317
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
304318
mapped_exec = executor.map(support_matrix, all_ports_all_boards())
305319
# flatmap with comprehensions
306-
boards = dict(sorted([board for matrix in mapped_exec for board in matrix]))
320+
boards = dict(sorted([board for matrix in mapped_exec for board in matrix], key=lambda x: x[0]))
307321

308322
return boards
309323

ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/boards/uchip/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Itaca Innovation"
66
CHIP_VARIANT = SAMD21E18A
77
CHIP_FAMILY = samd21
88

9-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
1010

1111
INTERNAL_FLASH_FILESYSTEM = 1
1212
LONGINT_IMPL = NONE

ports/atmel-samd/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,4 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO)
134134
endif # same51
135135
######################################################################
136136

137-
CIRCUITPY_BUILD_EXTENSIONS ?= BIN_UF2
137+
CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2

ports/broadcom/boards/raspberrypi_zero/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ USB_MANUFACTURER = "Raspberry Pi"
55

66
CHIP_VARIANT = "bcm2835"
77

8-
CIRCUITPY_BUILD_EXTENSIONS = KERNEL_IMG
8+
CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img

ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ USB_MANUFACTURER = "Raspberry Pi"
55

66
CHIP_VARIANT = "bcm2835"
77

8-
CIRCUITPY_BUILD_EXTENSIONS = KERNEL_IMG
8+
CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img

ports/broadcom/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ INTERNAL_FLASH_FILESYSTEM = 1
2525
USB_NUM_ENDPOINT_PAIRS = 8
2626
USB_HIGHSPEED = 1
2727

28-
CIRCUITPY_BUILD_EXTENSIONS ?= KERNEL8_IMG
28+
CIRCUITPY_BUILD_EXTENSIONS ?= disk.img.zip,kernel8.img

ports/cxd56/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ CIRCUITPY_USB_HID = 0
2626
CIRCUITPY_USB_MIDI = 0
2727
INTERNAL_LIBM = 1
2828

29-
CIRCUITPY_BUILD_EXTENSIONS ?= SPK
29+
CIRCUITPY_BUILD_EXTENSIONS ?= spk

ports/espressif/mpconfigport.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CIRCUITPY_PARALLELDISPLAY = 0
4040
# Protomatter needs to support ESP32.
4141
CIRCUITPY_RGBMATRIX = 0
4242
CIRCUITPY_USB = 0
43-
CIRCUITPY_BUILD_EXTENSIONS ?= BIN
43+
CIRCUITPY_BUILD_EXTENSIONS ?= bin
4444

4545
else ifeq ($(IDF_TARGET),esp32c3)
4646
CIRCUITPY_AESIO = 0
@@ -58,7 +58,7 @@ CIRCUITPY_ROTARYIO = 0
5858
CIRCUITPY_TOUCHIO ?= 1
5959
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
6060
CIRCUITPY_USB = 0
61-
CIRCUITPY_BUILD_EXTENSIONS ?= BIN
61+
CIRCUITPY_BUILD_EXTENSIONS ?= bin
6262

6363
else ifeq ($(IDF_TARGET),esp32s3)
6464
CIRCUITPY_BLEIO = 1
@@ -72,7 +72,7 @@ CIRCUITPY_BLEIO = 0
7272
CIRCUITPY_BLEIO_HCI = 0
7373
endif
7474

75-
CIRCUITPY_BUILD_EXTENSIONS ?= BIN_UF2
75+
CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2
7676

7777
# From ESP32-S2/S3 Technical Reference Manual:
7878
#

ports/litex/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ CIRCUITPY_SDCARDIO = 0
3030
CIRCUITPY_USB_HID = 1
3131
CIRCUITPY_USB_MIDI = 1
3232

33-
CIRCUITPY_BUILD_EXTENSIONS ?= DFU
33+
CIRCUITPY_BUILD_EXTENSIONS ?= dfu

ports/mimxrt10xx/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ CIRCUITPY_ROTARYIO = 0
2222
CIRCUITPY_USB_MIDI = 1
2323
LONGINT_IMPL = MPZ
2424

25-
CIRCUITPY_BUILD_EXTENSIONS ?= HEX_UF2
25+
CIRCUITPY_BUILD_EXTENSIONS ?= hex,uf2

ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ USB_MANUFACTURER = "Electronut Labs"
55

66
MCU_CHIP = nrf52840
77

8-
CIRCUITPY_BUILD_EXTENSIONS = HEX
8+
CIRCUITPY_BUILD_EXTENSIONS = hex
99

1010
INTERNAL_FLASH_FILESYSTEM = 1
1111
CIRCUITPY_AUDIOIO = 0

ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ USB_MANUFACTURER = "makerdiary"
55

66
MCU_CHIP = nrf52840
77

8-
CIRCUITPY_BUILD_EXTENSIONS = HEX
8+
CIRCUITPY_BUILD_EXTENSIONS = hex
99

1010
QSPI_FLASH_FILESYSTEM = 1
1111
EXTERNAL_FLASH_DEVICES = "MX25R6435F"

ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ USB_MANUFACTURER = "makerdiary"
55

66
MCU_CHIP = nrf52840
77

8-
CIRCUITPY_BUILD_EXTENSIONS = HEX_UF2
8+
CIRCUITPY_BUILD_EXTENSIONS = hex,uf2
99

1010
INTERNAL_FLASH_FILESYSTEM = 1

ports/nrf/boards/microbit_v2/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CIRCUITPY_CREATION_ID = 0x80D8
33

44
MCU_CHIP = nrf52833
55

6-
CIRCUITPY_BUILD_EXTENSIONS = COMBINED_HEX
6+
CIRCUITPY_BUILD_EXTENSIONS = combined.hex
77

88
INTERNAL_FLASH_FILESYSTEM = 1
99

ports/nrf/boards/pca10056/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ USB_MANUFACTURER = "Nordic Semiconductor"
55

66
MCU_CHIP = nrf52840
77

8-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
8+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
99

1010
QSPI_FLASH_FILESYSTEM = 1
1111
EXTERNAL_FLASH_DEVICES = "MX25R6435F"

ports/nrf/boards/pca10059/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ USB_MANUFACTURER = "Nordic Semiconductor"
55

66
MCU_CHIP = nrf52840
77

8-
CIRCUITPY_BUILD_EXTENSIONS = BIN_UF2
8+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
99

1010
INTERNAL_FLASH_FILESYSTEM = 1

ports/nrf/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LD_TEMPLATE_FILE = boards/common.template.ld
44

55
INTERNAL_LIBM = 1
66

7-
CIRCUITPY_BUILD_EXTENSIONS ?= UF2
7+
CIRCUITPY_BUILD_EXTENSIONS ?= uf2
88

99
# Number of USB endpoint pairs.
1010
USB_NUM_ENDPOINT_PAIRS = 8

ports/raspberrypi/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# All raspberrypi ports have longints.
22
LONGINT_IMPL = MPZ
3-
CIRCUITPY_BUILD_EXTENSIONS ?= UF2
3+
CIRCUITPY_BUILD_EXTENSIONS ?= uf2
44
CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1
55

66
CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1

ports/stm/boards/meowbit_v121/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ MCU_SERIES = F4
1313
MCU_VARIANT = STM32F401xE
1414
MCU_PACKAGE = LQFP64
1515

16-
CIRCUITPY_BUILD_EXTENSIONS = UF2
16+
CIRCUITPY_BUILD_EXTENSIONS = uf2
1717

1818
OPTIMIZATION_FLAGS = -Os
1919

ports/stm/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LONGINT_IMPL ?= MPZ
22
INTERNAL_LIBM ?= 1
33

4-
CIRCUITPY_BUILD_EXTENSIONS ?= BIN
4+
CIRCUITPY_BUILD_EXTENSIONS ?= bin
55

66
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F405xx STM32F407xx))
77
CIRCUITPY_ALARM = 1

shared-bindings/support_matrix.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ capable board, as well as each :term:`frozen module` included on it.
2121
{% for key, value in support_matrix|dictsort %}
2222
{{ '.. _' ~ key|replace(" ", "-") ~ ':' }}
2323
* - {{ key }}
24-
- {{ ':py:mod:`' ~ value[0]|join("`, :py:mod:`") ~ '`' }}
24+
- {{ ':py:mod:`' ~ value.modules|join("`, :py:mod:`") ~ '`' }}
2525

26-
{% for module in value[1] %}\
26+
{% for module in value.frozen_libraries %}\
2727
{% if loop.index == 1 %}**Frozen Modules:** {% endif %}\
2828
{% if loop.index > 1 %}, {% endif %}\
2929
{% if module[1] %}{{ '`' ~ module[0] ~ ' <' ~ module[1] ~ '>`__' }}\

0 commit comments

Comments
 (0)