Skip to content

Commit eabe8b9

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 d021d9a commit eabe8b9

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
@@ -52,8 +52,8 @@
5252
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
5353
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
5454
modules_support_matrix_reverse = defaultdict(list)
55-
for board, modules in modules_support_matrix.items():
56-
for module in modules[0]:
55+
for board, matrix_info in modules_support_matrix.items():
56+
for module in matrix_info["modules"]:
5757
modules_support_matrix_reverse[module].append(board)
5858

5959
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

0 commit comments

Comments
 (0)