Skip to content

Commit 3158315

Browse files
committed
Merge branch 'main' of https://github.com/adafruit/circuitpython into arduino-nano-esp32s3
2 parents e931a52 + 394ed2a commit 3158315

Some content is hidden

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

59 files changed

+1095
-373
lines changed

conf.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from sphinx.transforms import SphinxTransform
3131
from docutils import nodes
3232
from sphinx import addnodes
33+
from sphinx.ext import intersphinx
3334

3435
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
3536

@@ -441,7 +442,8 @@ def autoapi_prepare_jinja_env(jinja_env):
441442

442443
# Example configuration for intersphinx: refer to the Python standard library.
443444
intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
444-
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
445+
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),
446+
"typing": ('https://circuitpython.readthedocs.io/projects/adafruit-circuitpython-typing/en/latest/', None)}
445447

446448
# Adapted from sphinxcontrib-redirects
447449
from sphinx.builders import html as builders
@@ -483,6 +485,26 @@ def generate_redirects(app):
483485
with open(redirected_filename, 'w') as f:
484486
f.write(TEMPLATE % urllib.parse.quote(to_path, '#/'))
485487

488+
def adafruit_typing_workaround(app, env, node, contnode):
489+
# Sphinx marks a requesting node that uses circuitpython-typing
490+
# as looking for a "class" definition, but unfortunately
491+
# Sphinx doesn't recognize TypeAlias based types usefully from
492+
# the typing library.
493+
# (see: https://github.com/sphinx-doc/sphinx/issues/8934)
494+
# Instead, it categorizes these types as "data".
495+
# (see: python -m sphinx.ext.intersphinx \
496+
# https://docs.circuitpython.org/projects/adafruit-circuitpython-typing/en/latest/objects.inv)
497+
# This workaround traps missing references, checks if
498+
# they are likely to be in the circuitpython_typing package,
499+
# and changes the requesting type from "class" to "data" if
500+
# needed, and re-tries the reference resolver.
501+
ref = node.get("reftarget", None)
502+
if ref and ref.startswith("circuitpython_typing."):
503+
dtype = node.get("reftype", None)
504+
if dtype != "data":
505+
node.attributes.update({"reftype": "data"})
506+
return intersphinx.missing_reference(app, env, node, contnode)
507+
486508

487509
class CoreModuleTransform(SphinxTransform):
488510
default_priority = 870
@@ -519,4 +541,5 @@ def setup(app):
519541
app.add_js_file("filter.js")
520542
app.add_config_value('redirects_file', 'redirects', 'env')
521543
app.connect('builder-inited', generate_redirects)
544+
app.connect('missing-reference', adafruit_typing_workaround)
522545
app.add_transform(CoreModuleTransform)

docs/redirects.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
index.rst README.html
12
shared-bindings//__init__.rst shared-bindings//
23
shared-bindings/_bleio/Adapter.rst shared-bindings/_bleio/#_bleio.Adapter
34
shared-bindings/_bleio/Address.rst shared-bindings/_bleio/#_bleio.Address

docs/shared_bindings_matrix.py

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -148,66 +148,36 @@ def get_board_mapping():
148148
return boards
149149

150150

151-
def read_mpconfig():
152-
"""Open 'circuitpy_mpconfig.mk' and return the contents."""
153-
configs = []
154-
cpy_mpcfg = get_circuitpython_root_dir() / "py" / "circuitpy_mpconfig.mk"
155-
with open(cpy_mpcfg) as mpconfig:
156-
configs = mpconfig.read()
157-
158-
return configs
159-
160-
161151
def build_module_map():
162152
"""Establish the base of the JSON file, based on the contents from
163-
`configs`. Base will contain module names, if they're part of
164-
the `FULL_BUILD`, or their default value (0, 1, or a list of
165-
modules that determine default [see audiocore, audiomixer, etc.]).
166-
153+
`configs`. Base contains the module name and the controlling C macro name.
167154
"""
168155
base = dict()
169156
modules = get_bindings()
170-
configs = read_mpconfig()
171-
full_build = False
172157
for module in modules:
173158
full_name = module
174159
if module in ADDITIONAL_MODULES:
175160
search_identifier = ADDITIONAL_MODULES[module]
176161
else:
177162
search_identifier = "CIRCUITPY_" + module.lstrip("_").upper()
178-
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
179-
find_config = re.findall(re_pattern, configs)
180-
if not find_config:
181-
continue
182-
find_config = ", ".join([x.strip("$()") for x in find_config])
183-
184-
full_build = int("CIRCUITPY_FULL_BUILD" in find_config)
185-
if not full_build:
186-
default_val = find_config
187-
else:
188-
default_val = "None"
189163

190164
base[module] = {
191165
"name": full_name,
192-
"full_build": str(full_build),
193-
"default_value": default_val,
194-
"excluded": {},
195166
"key": search_identifier,
196167
}
197168

198169
return base
199170

200171

201172
def get_settings_from_makefile(port_dir, board_name):
202-
"""Invoke make in a mode which prints the database, then parse it for
203-
settings.
173+
"""Invoke make to print the value of critical build settings
204174
205175
This means that the effect of all Makefile directives is taken
206176
into account, without having to re-encode the logic that sets them
207177
in this script, something that has proved error-prone
208178
"""
209179
contents = subprocess.run(
210-
["make", "-C", port_dir, f"BOARD={board_name}", "-qp", "print-CC"],
180+
["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-FROZEN_MPY_DIRS", "print-SRC_PATTERNS"],
211181
encoding="utf-8",
212182
errors="replace",
213183
stdout=subprocess.PIPE,
@@ -223,9 +193,10 @@ def get_settings_from_makefile(port_dir, board_name):
223193

224194
settings = {}
225195
for line in contents.stdout.split("\n"):
226-
# Handle both = and := definitions.
227-
m = re.match(r"^([A-Z][A-Z0-9_]*) :?= (.*)$", line)
228-
if m:
196+
if line.startswith('CFLAGS ='):
197+
for m in re.findall('-D([A-Z][A-Z0-9_]*)=(\d+)', line):
198+
settings[m[0]] = m[1]
199+
elif m := re.match(r"^([A-Z][A-Z0-9_]*) = (.*)$", line):
229200
settings[m.group(1)] = m.group(2)
230201

231202
return settings
@@ -268,6 +239,10 @@ def get_repository_url(directory):
268239
repository_urls[directory] = path
269240
return path
270241

242+
def remove_prefix(s, prefix):
243+
if not s.startswith(prefix):
244+
raise ValueError(f"{s=} does not start with {prefix=}")
245+
return s.removeprefix(prefix)
271246

272247
def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
273248
"""
@@ -280,7 +255,8 @@ def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
280255
"""
281256
frozen_modules = []
282257
for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")):
283-
source_dir = get_circuitpython_root_dir() / frozen_path[7:]
258+
frozen_path = remove_prefix(frozen_path, '../../')
259+
source_dir = get_circuitpython_root_dir() / frozen_path
284260
url_repository = get_repository_url(source_dir)
285261
for sub in source_dir.glob("*"):
286262
if sub.name in FROZEN_EXCLUDES:

locale/ID.po

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,10 @@ msgstr ""
17701770
msgid "Pins must share PWM slice"
17711771
msgstr ""
17721772

1773+
#: shared-module/usb/core/Device.c
1774+
msgid "Pipe error"
1775+
msgstr ""
1776+
17731777
#: py/builtinhelp.c
17741778
msgid "Plus any modules on the filesystem\n"
17751779
msgstr "Tambahkan module apapun pada filesystem\n"
@@ -1849,7 +1853,8 @@ msgstr "Kesalahan pembuatan nomor acak"
18491853

18501854
#: shared-bindings/_bleio/__init__.c
18511855
#: shared-bindings/memorymonitor/AllocationSize.c
1852-
#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c
1856+
#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c
1857+
#: shared-module/displayio/Bitmap.c
18531858
msgid "Read-only"
18541859
msgstr "Baca-saja"
18551860

@@ -2077,8 +2082,8 @@ msgid "Too many channels in sample."
20772082
msgstr "Terlalu banyak channel dalam sampel"
20782083

20792084
#: shared-module/displayio/__init__.c
2080-
msgid "Too many display busses"
2081-
msgstr "Terlalu banyak tampilan bus"
2085+
msgid "Too many display busses; forgot displayio.release_displays() ?"
2086+
msgstr ""
20822087

20832088
#: shared-module/displayio/__init__.c
20842089
msgid "Too many displays"
@@ -3282,6 +3287,10 @@ msgstr ""
32823287
msgid "input dtype must be float or complex"
32833288
msgstr ""
32843289

3290+
#: extmod/ulab/code/numpy/poly.c
3291+
msgid "input is not iterable"
3292+
msgstr ""
3293+
32853294
#: extmod/ulab/code/numpy/linalg/linalg.c
32863295
msgid "input matrix is asymmetric"
32873296
msgstr ""
@@ -3327,10 +3336,6 @@ msgstr ""
33273336
msgid "input vectors must be of equal length"
33283337
msgstr ""
33293338

3330-
#: extmod/ulab/code/numpy/poly.c
3331-
msgid "inputs are not iterable"
3332-
msgstr ""
3333-
33343339
#: extmod/ulab/code/numpy/approx.c
33353340
msgid "interp is defined for 1D iterables of equal length"
33363341
msgstr ""
@@ -4050,7 +4055,7 @@ msgstr ""
40504055
msgid "sosfilt requires iterable arguments"
40514056
msgstr ""
40524057

4053-
#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
4058+
#: shared-bindings/bitmaptools/__init__.c
40544059
msgid "source palette too large"
40554060
msgstr ""
40564061

@@ -4385,6 +4390,9 @@ msgstr "zi harus berjenis float"
43854390
msgid "zi must be of shape (n_section, 2)"
43864391
msgstr "Zi harus berbentuk (n_section, 2)"
43874392

4393+
#~ msgid "Too many display busses"
4394+
#~ msgstr "Terlalu banyak tampilan bus"
4395+
43884396
#~ msgid "Hardware busy, try alternative pins"
43894397
#~ msgstr "Perangkat keras sibuk, coba pin alternatif"
43904398

locale/circuitpython.pot

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,10 @@ msgstr ""
14731473
msgid "No capture in progress"
14741474
msgstr ""
14751475

1476+
#: shared-module/usb/core/Device.c
1477+
msgid "No configuration set"
1478+
msgstr ""
1479+
14761480
#: shared-bindings/_bleio/PacketBuffer.c
14771481
msgid "No connection: length cannot be determined"
14781482
msgstr ""
@@ -1536,6 +1540,10 @@ msgstr ""
15361540
msgid "No timer available"
15371541
msgstr ""
15381542

1543+
#: shared-module/usb/core/Device.c
1544+
msgid "No usb host port initialized"
1545+
msgstr ""
1546+
15391547
#: ports/nrf/common-hal/_bleio/__init__.c
15401548
msgid "Nordic system firmware out of memory"
15411549
msgstr ""
@@ -2056,7 +2064,7 @@ msgid "Too many channels in sample."
20562064
msgstr ""
20572065

20582066
#: shared-module/displayio/__init__.c
2059-
msgid "Too many display busses"
2067+
msgid "Too many display busses; forgot displayio.release_displays() ?"
20602068
msgstr ""
20612069

20622070
#: shared-module/displayio/__init__.c
@@ -3259,6 +3267,10 @@ msgstr ""
32593267
msgid "input dtype must be float or complex"
32603268
msgstr ""
32613269

3270+
#: extmod/ulab/code/numpy/poly.c
3271+
msgid "input is not iterable"
3272+
msgstr ""
3273+
32623274
#: extmod/ulab/code/numpy/linalg/linalg.c
32633275
msgid "input matrix is asymmetric"
32643276
msgstr ""
@@ -3304,10 +3316,6 @@ msgstr ""
33043316
msgid "input vectors must be of equal length"
33053317
msgstr ""
33063318

3307-
#: extmod/ulab/code/numpy/poly.c
3308-
msgid "inputs are not iterable"
3309-
msgstr ""
3310-
33113319
#: extmod/ulab/code/numpy/approx.c
33123320
msgid "interp is defined for 1D iterables of equal length"
33133321
msgstr ""

locale/cs.po

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,10 @@ msgstr ""
17611761
msgid "Pins must share PWM slice"
17621762
msgstr ""
17631763

1764+
#: shared-module/usb/core/Device.c
1765+
msgid "Pipe error"
1766+
msgstr ""
1767+
17641768
#: py/builtinhelp.c
17651769
msgid "Plus any modules on the filesystem\n"
17661770
msgstr ""
@@ -1840,7 +1844,8 @@ msgstr ""
18401844

18411845
#: shared-bindings/_bleio/__init__.c
18421846
#: shared-bindings/memorymonitor/AllocationSize.c
1843-
#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c
1847+
#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c
1848+
#: shared-module/displayio/Bitmap.c
18441849
msgid "Read-only"
18451850
msgstr ""
18461851

@@ -2066,7 +2071,7 @@ msgid "Too many channels in sample."
20662071
msgstr ""
20672072

20682073
#: shared-module/displayio/__init__.c
2069-
msgid "Too many display busses"
2074+
msgid "Too many display busses; forgot displayio.release_displays() ?"
20702075
msgstr ""
20712076

20722077
#: shared-module/displayio/__init__.c
@@ -3269,6 +3274,10 @@ msgstr ""
32693274
msgid "input dtype must be float or complex"
32703275
msgstr ""
32713276

3277+
#: extmod/ulab/code/numpy/poly.c
3278+
msgid "input is not iterable"
3279+
msgstr ""
3280+
32723281
#: extmod/ulab/code/numpy/linalg/linalg.c
32733282
msgid "input matrix is asymmetric"
32743283
msgstr ""
@@ -3314,10 +3323,6 @@ msgstr ""
33143323
msgid "input vectors must be of equal length"
33153324
msgstr ""
33163325

3317-
#: extmod/ulab/code/numpy/poly.c
3318-
msgid "inputs are not iterable"
3319-
msgstr ""
3320-
33213326
#: extmod/ulab/code/numpy/approx.c
33223327
msgid "interp is defined for 1D iterables of equal length"
33233328
msgstr ""
@@ -4036,7 +4041,7 @@ msgstr ""
40364041
msgid "sosfilt requires iterable arguments"
40374042
msgstr ""
40384043

4039-
#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
4044+
#: shared-bindings/bitmaptools/__init__.c
40404045
msgid "source palette too large"
40414046
msgstr ""
40424047

0 commit comments

Comments
 (0)