Skip to content

Commit 0fd6e21

Browse files
committed
Merge remote-tracking branch 'upstream/main' into main
2 parents ba8cf68 + 9535edb commit 0fd6e21

File tree

656 files changed

+53655
-5747
lines changed

Some content is hidden

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

656 files changed

+53655
-5747
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Install deps
3737
run: |
3838
sudo apt-get install -y eatmydata
39-
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
39+
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
4040
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli
4141
- name: Versions
4242
run: |
@@ -73,17 +73,26 @@ jobs:
7373
with:
7474
name: stubs
7575
path: circuitpython-stubs*
76-
- name: Docs
76+
- name: Test Documentation Build (HTML)
7777
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
7878
- uses: actions/upload-artifact@v2
7979
with:
8080
name: docs
8181
path: _build/html
82+
- name: Test Documentation Build (LaTeX/PDF)
83+
run: |
84+
make latexpdf
85+
- uses: actions/upload-artifact@v2
86+
with:
87+
name: docs
88+
path: _build/latex
8289
- name: Translations
8390
run: make check-translate
8491
- name: New boards check
8592
run: python3 -u ci_new_boards_check.py
8693
working-directory: tools
94+
- name: Duplicate USB VID/PID Check
95+
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
8796
- name: Build mpy-cross.static-raspbian
8897
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
8998
- uses: actions/upload-artifact@v2
@@ -170,7 +179,7 @@ jobs:
170179
- "arduino_nano_33_iot"
171180
- "arduino_zero"
172181
- "bast_pro_mini_m0"
173-
- "bdmicro_vina_m0"
182+
- "bdmicro_vina_d21"
174183
- "bless_dev_board_multi_sensor"
175184
- "blm_badge"
176185
- "capablerobot_usbhub"
@@ -201,6 +210,7 @@ jobs:
201210
- "feather_m0_rfm69"
202211
- "feather_m0_rfm9x"
203212
- "feather_m0_supersized"
213+
- "feather_m4_can"
204214
- "feather_m4_express"
205215
- "feather_m7_1011"
206216
- "feather_mimxrt1011"
@@ -227,6 +237,7 @@ jobs:
227237
- "makerdiary_nrf52840_m2_devkit"
228238
- "makerdiary_nrf52840_mdk"
229239
- "makerdiary_nrf52840_mdk_usb_dongle"
240+
- "matrixportal_m4"
230241
- "meowbit_v121"
231242
- "meowmeow"
232243
- "metro_m0_express"
@@ -253,6 +264,7 @@ jobs:
253264
- "pca10100"
254265
- "pewpew10"
255266
- "pewpew_m4"
267+
- "picoplanet"
256268
- "pirkey_m0"
257269
- "pitaya_go"
258270
- "pyb_nano_v2"
@@ -266,6 +278,8 @@ jobs:
266278
- "pyportal"
267279
- "pyportal_titano"
268280
- "pyruler"
281+
- "qtpy_m0"
282+
- "qtpy_m0_haxpress"
269283
- "raytac_mdbt50q-db-40"
270284
- "robohatmm1_m4"
271285
- "sam32"
@@ -400,9 +414,15 @@ jobs:
400414
fail-fast: false
401415
matrix:
402416
board:
417+
- "adafruit_metro_esp32s2"
418+
- "electroniccats_bastwifi"
419+
- "espressif_kaluga_1"
403420
- "espressif_saola_1_wroom"
404421
- "espressif_saola_1_wrover"
422+
- "microdev_micro_s2"
423+
- "muselab_nanoesp32_s2"
405424
- "unexpectedmaker_feathers2"
425+
- "unexpectedmaker_feathers2_prerelease"
406426

407427
steps:
408428
- name: Set up Python 3.8
@@ -422,6 +442,11 @@ jobs:
422442
with:
423443
path: ${{ github.workspace }}/.idf_tools
424444
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801
445+
- name: Clone IDF submodules
446+
run: |
447+
(cd $IDF_PATH && git submodule update --init)
448+
env:
449+
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
425450
- name: Install IDF tools
426451
run: |
427452
$IDF_PATH/tools/idf_tools.py --non-interactive install required

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ _build
5757
######################
5858
genrst/
5959
/autoapi/
60-
/shared-bindings/**/*.rst
60+
/shared-bindings/*/**/*.rst
6161

6262
# ctags and similar
6363
###################
@@ -80,5 +80,9 @@ TAGS
8080
*.mo
8181

8282
.vscode
83-
8483
.idea
84+
85+
# Python Virtual Environments
86+
####################
87+
.venv
88+
.env

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,9 @@
147147
[submodule "ports/esp32s2/esp-idf"]
148148
path = ports/esp32s2/esp-idf
149149
url = https://github.com/tannewt/esp-idf.git
150+
[submodule "frozen/Adafruit_CircuitPython_RFM9x"]
151+
path = frozen/Adafruit_CircuitPython_RFM9x
152+
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git
153+
[submodule "frozen/Adafruit_CircuitPython_RFM69"]
154+
path = frozen/Adafruit_CircuitPython_RFM69
155+
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repos:
88
hooks:
99
- id: check-yaml
1010
- id: end-of-file-fixer
11-
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
11+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)'
1212
- id: trailing-whitespace
1313
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'

.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
version: 2
1010

11+
submodules:
12+
include:
13+
- extmod/ulab
14+
15+
formats:
16+
- pdf
17+
1118
python:
1219
version: 3
1320
install:

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
4040
# the i18n builder cannot share the environment and doctrees with the others
4141
I18NSPHINXOPTS = $(BASEOPTS)
4242

43-
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
43+
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
44+
# Paths to exclude from TRANSLATE_SOURCES
45+
# Each must be preceded by "-path"; if any wildcards, enclose in quotes.
46+
# Separate by "-o" (Find's "or" operand)
47+
TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \
48+
-o -path "ports/*/build" \
49+
-o -path ports/esp32s2/esp-idf \
50+
-o -path ports/cxd56/spresense-exported-sdk \
51+
-o -path ports/stm/st_driver \
52+
-o -path ports/atmel-samd/asf4 \
53+
-o -path ports/mimxrt10xx/sdk \
54+
-o -path lib/tinyusb \
55+
-o -path lib/lwip \
4456

4557
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
4658

@@ -210,7 +222,7 @@ pseudoxml:
210222
all-source:
211223

212224
locale/circuitpython.pot: all-source
213-
find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
225+
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
214226

215227
# Historically, `make translate` updated the .pot file and ran msgmerge.
216228
# However, this was a frequent source of merge conflicts. Weblate can perform
@@ -235,7 +247,7 @@ merge-translate:
235247

236248
.PHONY: check-translate
237249
check-translate:
238-
find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot.tmp -p locale
250+
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot.tmp -p locale
239251
$(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status
240252

241253
stubs:
@@ -245,6 +257,10 @@ stubs:
245257
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
246258
@$(PYTHON) setup.py -q sdist
247259

260+
.PHONY: check-stubs
261+
check-stubs: stubs
262+
MYPYPATH=$(STUBDIR) mypy --strict $(STUBDIR)
263+
248264
update-frozen-libraries:
249265
@echo "Updating all frozen libraries to latest tagged version."
250266
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done

conf.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
#
1818
# SPDX-License-Identifier: MIT
1919

20-
import json
2120
import logging
2221
import os
22+
import re
2323
import subprocess
2424
import sys
2525
import urllib.parse
2626

2727
import recommonmark
28+
from sphinx.transforms import SphinxTransform
29+
from docutils import nodes
30+
from sphinx import addnodes
2831

2932
# If extensions (or modules to document with autodoc) are in another directory,
3033
# add these directories to sys.path here. If the directory is relative to the
@@ -39,6 +42,9 @@
3942
# Grab the JSON values to use while building the module support matrix
4043
# in 'shared-bindings/index.rst'
4144

45+
# The stubs must be built before we calculate the shared bindings matrix
46+
subprocess.check_output(["make", "stubs"])
47+
4248
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
4349
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
4450

@@ -74,7 +80,6 @@
7480
'.md': 'markdown',
7581
}
7682

77-
subprocess.check_output(["make", "stubs"])
7883
extensions.append('autoapi.extension')
7984

8085
autoapi_type = 'python'
@@ -84,6 +89,7 @@
8489
autoapi_add_toctree_entry = False
8590
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
8691
autoapi_template_dir = 'docs/autoapi/templates'
92+
autoapi_python_class_content = "both"
8793
autoapi_python_use_implicit_namespaces = True
8894
autoapi_root = "shared-bindings"
8995

@@ -106,7 +112,25 @@
106112
#
107113
# We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags"
108114
# breakdown, so use the same version identifier for both to avoid confusion.
109-
version = release = '0.0.0'
115+
116+
final_version = ""
117+
git_describe = subprocess.run(
118+
["git", "describe", "--dirty", "--tags"],
119+
stdout=subprocess.PIPE,
120+
stderr=subprocess.STDOUT,
121+
encoding="utf-8"
122+
)
123+
if git_describe.returncode == 0:
124+
git_version = re.search(
125+
r"^\d(?:\.\d){0,2}(?:\-(?:alpha|beta|rc)\.\d+){0,1}",
126+
str(git_describe.stdout)
127+
)
128+
if git_version:
129+
final_version = git_version[0]
130+
else:
131+
print("Failed to retrieve git version:", git_describe.stdout)
132+
133+
version = release = final_version
110134

111135
# The language for content autogenerated by Sphinx. Refer to documentation
112136
# for a list of supported languages.
@@ -122,6 +146,7 @@
122146
# directories to ignore when looking for source files.
123147
exclude_patterns = ["**/build*",
124148
".git",
149+
".env",
125150
".venv",
126151
".direnv",
127152
"docs/autoapi",
@@ -423,7 +448,38 @@ def generate_redirects(app):
423448
with open(redirected_filename, 'w') as f:
424449
f.write(TEMPLATE % urllib.parse.quote(to_path, '#/'))
425450

451+
452+
class CoreModuleTransform(SphinxTransform):
453+
default_priority = 870
454+
455+
def _convert_first_paragraph_into_title(self):
456+
title = self.document.next_node(nodes.title)
457+
paragraph = self.document.next_node(nodes.paragraph)
458+
if not title or not paragraph:
459+
return
460+
if isinstance(paragraph[0], nodes.paragraph):
461+
paragraph = paragraph[0]
462+
if all(isinstance(child, nodes.Text) for child in paragraph.children):
463+
for child in paragraph.children:
464+
title.append(nodes.Text(" \u2013 "))
465+
title.append(child)
466+
paragraph.parent.remove(paragraph)
467+
468+
def _enable_linking_to_nonclass_targets(self):
469+
for desc in self.document.traverse(addnodes.desc):
470+
for xref in desc.traverse(addnodes.pending_xref):
471+
if xref.attributes.get("reftype") == "class":
472+
xref.attributes.pop("refspecific", None)
473+
474+
def apply(self, **kwargs):
475+
docname = self.env.docname
476+
if docname.startswith(autoapi_root) and docname.endswith("/index"):
477+
self._convert_first_paragraph_into_title()
478+
self._enable_linking_to_nonclass_targets()
479+
480+
426481
def setup(app):
427482
app.add_css_file("customstyle.css")
428483
app.add_config_value('redirects_file', 'redirects', 'env')
429484
app.connect('builder-inited', generate_redirects)
485+
app.add_transform(CoreModuleTransform)

0 commit comments

Comments
 (0)