8000 Merge remote-tracking branch 'origin/main' into repl-ctrl-l · tannewt/circuitpython@975e3e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 975e3e2

Browse files
committed
Merge remote-tracking branch 'origin/main' into repl-ctrl-l
2 parents 920c68e + c4c1520 commit 975e3e2

File tree

74 files changed

+968
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+968
-312
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143

144144

145145
mpy-cross-mac:
146-
runs-on: macos-10.15
146+
runs-on: macos-11
147147
steps:
148148
- name: Dump GitHub context
149149
env:
@@ -176,27 +176,25 @@ jobs:
176176
run: make -C mpy-cross -j2
177177
- uses: actions/upload-artifact@v2
178178
with:
179-
name: mpy-cross-macos-catalina
179+
name: mpy-cross-macos-11-x64
180180
path: mpy-cross/mpy-cross
181-
- name: Select SDK for M1 build
182-
run: sudo xcode-select -switch /Applications/Xcode_12.3.app
183181
- name: Build mpy-cross (arm64)
184182
run: make -C mpy-cross -j2 -f Makefile.m1 V=2
185183
- uses: actions/upload-artifact@v2
186184
with:
187-
name: mpy-cross-macos-bigsur-arm64
185+
name: mpy-cross-macos-11-arm64
188186
path: mpy-cross/mpy-cross-arm64
189187
- name: Make universal binary
190-
run: lipo -create -output mpy-cross-macos-universal mpy-cross/mpy-cross mpy-cross/mpy-cross-arm64
188+
run: lipo -create -output mpy-cross-macos-11-universal mpy-cross/mpy-cross mpy-cross/mpy-cross-arm64
191189
- uses: actions/upload-artifact@v2
192190
with:
193-
name: mpy-cross-macos-universal
194-
path: mpy-cross-macos-universal
191+
name: mpy-cross-macos-11-universal
192+
path: mpy-cross-macos-11-universal
195193
- name: Upload mpy-cross build to S3
196194
run: |
197-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-universal-${{ env.CP_VERSION }} --no-progress --region us-east-1
198-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-bigsur-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1
199-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1
195+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-universal --no-progress --region us-east-1
196+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1
197+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-x64 --no-progress --region us-east-1
200198
env:
201199
AWS_PAGER: ''
202200
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

conf.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,6 @@
3333

3434
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
3535

36-
# Monkeypatch autoapi
37-
def _format_args(args_info, include_annotations=True, ignore_self=None):
38-
result = []
39-
40-
for i, (prefix, name, annotation, default) in enumerate(args_info):
41-
if i == 0 and ignore_self is not None and name == ignore_self:
42-
continue
43-
formatted = "{}{}{}{}".format(
44-
prefix or "",
45-
name or "",
46-
": {}".format(annotation) if annotation and include_annotations else "",
47-
(" = {}" if annotation else "={}").format(default) if default else "",
48-
)
49-
result.append(formatted)
50-
return ", ".join(result)
51-
52-
import autoapi.mappers.python.objects as objects
53-
objects._format_args = _format_args
54-
5536
# If extensions (or modules to document with autodoc) are in another directory,
5637
# add these directories to sys.path here. If the directory is relative to the
5738
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -71,8 +52,8 @@ def _format_args(args_info, include_annotations=True, ignore_self=None):
7152
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
7253
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
7354
modules_support_matrix_reverse = defaultdict(list)
74-
for board, modules in modules_support_matrix.items():
75-
for module in modules[0]:
55+
for board, matrix_info in modules_support_matrix.items():
56+
for module in matrix_info["modules"]:
7657
modules_support_matrix_reverse[module].append(board)
7758

7859
modules_support_matrix_reverse = dict(

docs/environment.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ CIRCUITPY_WEB_API_PASSWORD
3939
~~~~~~~~~~~~~~~~~~~~~~~~~~
4040
Password required to make modifications to the board from the Web Workflow.
4141

42+
CIRCUITPY_WEB_API_PORT
43+
~~~~~~~~~~~~~~~~~~~~~~
44+
TCP port number used for the web HTTP API. Defaults to 80 when omitted.
45+
4246
CIRCUITPY_WIFI_PASSWORD
4347
~~~~~~~~~~~~~~~~~~~~~~~
4448
Wi-Fi password used to auto connect to CIRCUITPY_WIFI_SSID.

docs/shared_bindings_matrix.py

Lines changed: 76 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
SUPPORTED_PORTS = ['atmel-samd', 'broadcom', 'cxd56', 'espressif', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm']
3434

35-
aliases_by_board = {
35+
ALIASES_BY_BOARD = {
3636
"circuitplayground_express": [
3737
"circuitplayground_express_4h",
3838
"circuitplayground_express_digikey_pycon2019",
@@ -43,7 +43,7 @@
4343
"pewpew10": ["pewpew13"],
4444
}
4545

46-
aliases_brand_names = {
46+
ALIASES_BRAND_NAMES = {
4747
"circuitplayground_express_4h":
4848
"Adafruit Circuit Playground Express 4-H",
4949
"circuitplayground_express_digikey_pycon2019":
@@ -58,36 +58,64 @@
5858
"PewPew 13",
5959
}
6060

61-
additional_modules = {
61+
ADDITIONAL_MODULES = {
6262
"fontio": "CIRCUITPY_DISPLAYIO",
6363
"terminalio": "CIRCUITPY_DISPLAYIO",
6464
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
6565
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF",
6666
"usb": "CIRCUITPY_USB_HOST",
6767
}
6868

69-
frozen_excludes = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
69+
FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
7070
"""Files and dirs at the root of a frozen directory that should be ignored.
7171
This is the same list as in the preprocess_frozen_modules script."""
7272

7373
repository_urls = {}
7474
"""Cache of repository URLs for frozen modules."""
7575

7676
def get_circuitpython_root_dir():
77-
""" The path to the root './circuitpython' directory
77+
""" The path to the root './circuitpython' directory.
7878
"""
7979
file_path = pathlib.Path(__file__).resolve()
8080
root_dir = file_path.parent.parent
8181

8282
return root_dir
8383

8484
def get_shared_bindings():
85-
""" Get a list of modules in shared-bindings based on folder names
85+
""" Get a list of modules in shared-bindings based on folder names.
8686
"""
8787
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
8888
return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"]
8989

9090

91+
def get_board_mapping():
92+
"""
93+
Compiles the list of boards from the directories, with aliases and mapping
94+
to the port.
95+
"""
96+
boards = {}
97+
for port in SUPPORTED_PORTS:
98+
board_path = os.path.join("../ports", port, "boards")
99+
for board_path in os.scandir(board_path):
100+
if board_path.is_dir():
101+
board_files = os.listdir(board_path.path)
102+
board_id = board_path.name
103+
aliases = ALIASES_BY_BOARD.get(board_path.name, [])
104+
boards[board_id] = {
105+
"port": port,
106+
"download_count": 0,
107+
"aliases": aliases,
108+
}
109+
for alias in aliases:
110+
boards[alias] = {
111+
"port": port,
112+
"download_count": 0,
113+
"alias": True,
114+
"aliases": [],
115+
}
116+
return boards
117+
118+
91119
def read_mpconfig():
92120
""" Open 'circuitpy_mpconfig.mk' and return the contents.
93121
"""
@@ -112,8 +140,8 @@ def build_module_map():
112140
full_build = False
113141
for module in modules:
114142
full_name = module
115-
if module in additional_modules:
116-
search_identifier = additional_modules[module]
143+
if module in ADDITIONAL_MODULES:
144+
search_identifier = ADDITIONAL_MODULES[module]
117145
else:
118146
search_identifier = 'CIRCUITPY_'+module.lstrip("_").upper()
119147
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
@@ -204,27 +232,33 @@ def get_repository_url(directory):
204232
repository_urls[directory] = path
205233
return path
206234

207-
def frozen_modules_from_dirs(frozen_mpy_dirs):
235+
def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
208236
"""
209237
Go through the list of frozen directories and extract the python modules.
210238
Paths are of the type:
211239
$(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
212240
$(TOP)/frozen/circuitpython-stage/meowbit
213241
Python modules are at the root of the path, and are python files or directories
214-
containing python files. Except the ones in the frozen_excludes list.
242+
containing python files. Except the ones in the FROZEN_EXCLUDES list.
215243
"""
216244
frozen_modules = []
217245
for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")):
218246
source_dir = get_circuitpython_root_dir() / frozen_path[7:]
219247
url_repository = get_repository_url(source_dir)
220248
for sub in source_dir.glob("*"):
221-
if sub.name in frozen_excludes:
249+
if sub.name in FROZEN_EXCLUDES:
222250
continue
223251
if sub.name.endswith(".py"):
224-
frozen_modules.append((sub.name[:-3], url_repository))
252+
if withurl:
253+
frozen_modules.append((sub.name[:-3], url_repository))
254+
else:
255+
frozen_modules.append(sub.name[:-3])
225256
continue
226257
if next(sub.glob("**/*.py"), None): # tests if not empty
227-
frozen_modules.append((sub.name, url_repository))
258+
if withurl:
259+
frozen_modules.append((sub.name, url_repository))
260+
else:
261+
frozen_modules.append(sub.name)
228262
return frozen_modules
229263

230264
def lookup_setting(settings, key, default=''):
@@ -244,7 +278,7 @@ def all_ports_all_boards(ports=SUPPORTED_PORTS):
244278
continue
245279
yield (port, entry)
246280

247-
def support_matrix_by_board(use_branded_name=True):
281+
def support_matrix_by_board(use_branded_name=True, withurl=True):
248282
""" Compiles a list of the available core modules available for each
249283
board.
250284
"""
@@ -272,29 +306,49 @@ def support_matrix(arg):
272306
board_modules.append(base[module]['name'])
273307
board_modules.sort()
274308

309+
if "CIRCUITPY_BUILD_EXTENSIONS" in settings:
310+
board_extensions = [
311+
extension.strip() for extension in
312+
settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
313+
]
314+
else:
315+
raise OSError(f"Board extensions undefined: {board_name}.")
316+
275317
frozen_modules = []
276318
if "FROZEN_MPY_DIRS" in settings:
277-
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"])
319+
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"], withurl)
278320
if frozen_modules:
279321
frozen_modules.sort()
280322

281323
# generate alias boards too
282-
board_matrix = [(board_name, (board_modules, frozen_modules))]
283-
if entry.name in aliases_by_board:
284-
for alias in aliases_by_board[entry.name]:
324+
board_matrix = [(
325+
board_name, {
326+
"modules": board_modules,
327+
"frozen_libraries": frozen_modules,
328+
"extensions": board_extensions,
329+
}
330+
)]
331+
if entry.name in ALIASES_BY_BOARD:
332+
for alias in ALIASES_BY_BOARD[entry.name]:
285333
if use_branded_name:
286-
if alias in aliases_brand_names:
287-
alias = aliases_brand_names[alias]
334+
if alias in ALIASES_BRAND_NAMES:
335+
alias = ALIASES_BRAND_NAMES[alias]
288336
else:
289337
alias = alias.replace("_"," ").title()
290-
board_matrix.append( (alias, (board_modules, frozen_modules)) )
338+
board_matrix.append((
339+
alias, {
340+
"modules": board_modules,
341+
"frozen_libraries": frozen_modules,
342+
"extensions": board_extensions,
343+
},
344+
))
291345

292346
return board_matrix # this is now a list of (board,modules)
293347

294348
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
295349
mapped_exec = executor.map(support_matrix, all_ports_all_boards())
296350
# flatmap with comprehensions
297-
boards = dict(sorted([board for matrix in mapped_exec for board in matrix]))
351+
boards = dict(sorted([board for matrix in mapped_exec for board in matrix], key=lambda x: x[0]))
298352

299353
return boards
300354

docs/workflows.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Read-only characteristic that returns the UTF-8 encoded version string.
7272
The web workflow is depends on adding Wi-Fi credentials into the `/.env` file. The keys are
7373
`CIRCUITPY_WIFI_SSID` and `CIRCUITPY_WIFI_PASSWORD`. Once these are defined, CircuitPython will
7474
automatically connect to the network and start the webserver used for the workflow. The webserver
75-
is on port 80. It also enables MDNS.
75+
is on port 80 unless overridden by `CIRCUITPY_WEB_API_PORT`. It also enables MDNS.
7676

7777
Here is an example `/.env`:
7878

@@ -83,6 +83,8 @@ CIRCUITPY_WIFI_PASSWORD='secretpassword'
8383

8484
# To enable modifying files from the web. Change this too!
8585
CIRCUITPY_WEB_API_PASSWORD='passw0rd'
86+
87+
CIRCUITPY_WEB_API_PORT=80
8688
```
8789

8890
MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a device specific

locale/pt_BR.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgstr ""
66
"Project-Id-Version: PACKAGE VERSION\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
9-
"PO-Revision-Date: 2022-07-15 21:21+0000\n"
9+
"PO-Revision-Date: 2022-07-24 22:22+0000\n"
1010
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
1111
"Language-Team: \n"
1212
"Language: pt_BR\n"
@@ -216,7 +216,7 @@ msgstr "todos os %q, %q, e %q devem ter mesmo comprimento"
216216

217217
#: py/objint.c
218218
msgid "%q=%q"
219-
msgstr ""
219+
msgstr "%q=%q"
220220

221221
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
222222
#, c-format

mpy-cross/Makefile.m1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ BUILD=build-arm64
77

88
include mpy-cross.mk
99
# Because mpy-cross.mk unconditionally overwrites CC for Darwin, we must set it BELOW the inclusion
10-
CC := $(shell xcrun --sdk macosx11.1 --find clang) -isysroot $(shell xcrun --sdk macosx11.1 --show-sdk-path) -target arm64-apple-macos11
10+
CC := $(shell xcrun --find clang) -isysroot $(shell xcrun --show-sdk-path) -target arm64-apple-macos11

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
66
CHIP_VARIANT = SAMD21G18A
77
CHIP_FAMILY = samd21
88

9+
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
10+
911
INTERNAL_FLASH_FILESYSTEM = 1
1012
LONGINT_IMPL = NONE
1113
CIRCUITPY_FULL_BUILD = 0

0 commit comments

Comments
 (0)
0