Merge pull request #8568 from dhalbert/doc-and-python-updates

fix busio example; update some scripts for Python 3.12
This commit is contained in:
Scott Shawcroft 2023-11-07 16:19:06 -08:00 committed by GitHub
commit a5bd4b2849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -170,7 +170,7 @@ def build_module_map():
search_identifier = ADDITIONAL_MODULES[module]
else:
search_identifier = "CIRCUITPY_" + module.lstrip("_").upper()
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
re_pattern = fr"{re.escape(search_identifier)}\s*\??=\s*(.+)"
find_config = re.findall(re_pattern, configs)
if not find_config:
continue
@ -242,12 +242,12 @@ def get_repository_url(directory):
with open(readme, "r") as fp:
for line in fp.readlines():
if m := re.match(
"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
r"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
line,
):
path = m.group(1)
break
if m := re.search("<(http[^>]+)>", line):
if m := re.search(r"<(http[^>]+)>", line):
path = m.group(1)
break
if path is None:

View File

@ -59,12 +59,15 @@
//| from board import *
//|
//| i2c = busio.I2C(SCL, SDA)
//| i2c.try_lock()
//| print(i2c.scan())
//| i2c.unlock()
//| i2c.deinit()
//|
//| This example will initialize the the device, run
//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the
//| hardware. The last step is optional because CircuitPython automatically
//| This example will initialize the the device, lock the I2C bus, run
//| :py:meth:`~busio.I2C.scan`, unlock the bus,
//| and then :py:meth:`~busio.I2C.deinit` the hardware.
//| The last step is optional because CircuitPython automatically
//| resets hardware after a program finishes.
//|
//| Note that drivers will typically handle communication if provided the bus

View File

@ -139,7 +139,7 @@ for board in build_boards:
# Flush so we will see something before 10 minutes has passed.
print(flush=True)
if (not build_all) and (language is LANGUAGE_FIRST) and (exit_status is 0):
if (not build_all) and (language == LANGUAGE_FIRST) and (exit_status == 0):
try:
with open(
f"../ports/{board_info['port']}/{build_dir}/firmware.size.json", "r"