Skip to content

Commit a5bd4b2

Browse files
authored
Merge pull request #8568 from dhalbert/doc-and-python-updates
fix busio example; update some scripts for Python 3.12
2 parents 217b894 + bfb8304 commit a5bd4b2

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

docs/shared_bindings_matrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def build_module_map():
170170
search_identifier = ADDITIONAL_MODULES[module]
171171
else:
172172
search_identifier = "CIRCUITPY_" + module.lstrip("_").upper()
173-
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
173+
re_pattern = fr"{re.escape(search_identifier)}\s*\??=\s*(.+)"
174174
find_config = re.findall(re_pattern, configs)
175175
if not find_config:
176176
continue
@@ -242,12 +242,12 @@ def get_repository_url(directory):
242242
with open(readme, "r") as fp:
243243
for line in fp.readlines():
244244
if m := re.match(
245-
"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
245+
r"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
246246
line,
247247
):
248248
path = m.group(1)
249249
break
250-
if m := re.search("<(http[^>]+)>", line):
250+
if m := re.search(r"<(http[^>]+)>", line):
251251
path = m.group(1)
252252
break
253253
if path is None:

shared-bindings/busio/__init__.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,15 @@
5959
//| from board import *
6060
//|
6161
//| i2c = busio.I2C(SCL, SDA)
62+
//| i2c.try_lock()
6263
//| print(i2c.scan())
64+
//| i2c.unlock()
6365
//| i2c.deinit()
6466
//|
65-
//| This example will initialize the the device, run
66-
//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the
67-
//| hardware. The last step is optional because CircuitPython automatically
67+
//| This example will initialize the the device, lock the I2C bus, run
68+
//| :py:meth:`~busio.I2C.scan`, unlock the bus,
69+
//| and then :py:meth:`~busio.I2C.deinit` the hardware.
70+
//| The last step is optional because CircuitPython automatically
6871
//| resets hardware after a program finishes.
6972
//|
7073
//| Note that drivers will typically handle communication if provided the bus

tools/build_release_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
# Flush so we will see something before 10 minutes has passed.
140140
print(flush=True)
141141

142-
if (not build_all) and (language is LANGUAGE_FIRST) and (exit_status is 0):
142+
if (not build_all) and (language == LANGUAGE_FIRST) and (exit_status == 0):
143143
try:
144144
with open(
145145
f"../ports/{board_info['port']}/{build_dir}/firmware.size.json", "r"

0 commit comments

Comments
 (0)