Skip to content

Commit 023054e

Browse files
committed
Merge branch 'main' of https://github.com/adafruit/circuitpython into ci_check_vid_pid
2 parents c7b6d35 + 9866646 commit 023054e

File tree

444 files changed

+6427
-3310
lines changed

Some content is hidden

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

444 files changed

+6427
-3310
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ jobs:
1616
env:
1717
GITHUB_CONTEXT: ${{ toJson(github) }}
1818
run: echo "$GITHUB_CONTEXT"
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v2.2.0
2020
with:
2121
submodules: true
2222
fetch-depth: 0
2323
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
24-
- run: git submodule sync
25-
- run: git submodule foreach git remote -v
26-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
2724
- name: CircuitPython version
2825
run: git describe --dirty --tags
2926
- name: Set up Python 3.8
@@ -66,8 +63,16 @@ jobs:
6663
working-directory: tests
6764
- name: Stubs
6865
run: make stubs -j2
66+
- uses: actions/upload-artifact@v2
67+
with:
68+
name: stubs
69+
path: circuitpython-stubs*
6970
- name: Docs
7071
run: sphinx-build -E -W -b html . _build/html
72+
- uses: actions/upload-artifact@v2
73+
with:
74+
name: docs
75+
path: _build/html
7176
- name: Translations
7277
run: make check-translate
7378
- name: New boards check
@@ -112,14 +117,11 @@ jobs:
112117
gcc --version
113118
python3 --version
114119
msgfmt --version
115-
- uses: actions/checkout@v2
120+
- uses: actions/checkout@v2.2.0
116121
with:
117122
submodules: true
118123
fetch-depth: 0
119124
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
120-
- run: git submodule sync
121-
- run: git submodule foreach git remote -v
122-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
123125
- name: CircuitPython version
124126
run: git describe --dirty --tags
125127
- name: Build mpy-cross
@@ -207,6 +209,7 @@ jobs:
207209
- "monster_m4sk"
208210
- "ndgarage_ndbit6"
209211
- "nfc_copy_cat"
212+
- "nice_nano"
210213
- "nucleo_f746zg"
211214
- "nucleo_f767zi"
212215
- "nucleo_h743zi_2"
@@ -287,14 +290,11 @@ jobs:
287290
gcc --version
288291
arm-none-eabi-gcc --version
289292
python3 --version
290-
- uses: actions/checkout@v2
293+
- uses: actions/checkout@v2.2.0
291294
with:
292295
submodules: true
293296
fetch-depth: 0
294297
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
295-
- run: git submodule sync
296-
- run: git submodule foreach git remote -v
297-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
298298
- name: mpy-cross
299299
run: make -C mpy-cross -j2
300300
- name: build
@@ -338,14 +338,11 @@ jobs:
338338
gcc --version
339339
riscv64-unknown-elf-gcc --version
340340
python3 --version
341-
- uses: actions/checkout@v2
341+
- uses: actions/checkout@v2.2.0
342342
with:
343343
submodules: true
344344
fetch-depth: 0
345345
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
346-
- run: git submodule sync
347-
- run: git submodule foreach git remote -v
348-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
349346
- name: mpy-cross
350347
run: make -C mpy-cross -j2
351348
- name: build
@@ -378,14 +375,11 @@ jobs:
378375
uses: actions/setup-python@v1
379376
with:
380377
python-version: 3.8
381-
- uses: actions/checkout@v2
378+
- uses: actions/checkout@v2.2.0
382379
with:
383380
submodules: true
384381
fetch-depth: 0
385382
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
386-
- run: git submodule sync
387-
- run: git submodule foreach git remote -v
388-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
389383
- name: CircuitPython version
390384
run: git describe --dirty --tags
391385
- uses: actions/cache@v1

.github/workflows/create_website_pr.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ jobs:
1818
python-version: 3.8
1919
- name: Install deps
2020
run: |
21-
pip install requests sh click
21+
pip install requests sh click
2222
- name: Versions
2323
run: |
2424
gcc --version
2525
python3 --version
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v2.2.0
2727
with:
2828
submodules: true
2929
fetch-depth: 0
3030
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
31-
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
3231
- name: CircuitPython version
3332
run: git describe --dirty --tags
3433
- name: Website

.github/workflows/pre-commit.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: pre-commit
6+
7+
on:
8+
pull_request:
9+
push:
10+
branches: [main]
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- uses: actions/setup-python@v1
18+
- name: set PY
19+
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
20+
- uses: actions/cache@v1
21+
with:
22+
path: ~/.cache/pre-commit
23+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
24+
- uses: pre-commit/[email protected]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ _build
5353
######################
5454
genrst/
5555
/autoapi/
56+
/shared-bindings/**/*.rst
5657

5758
# ctags and similar
5859
###################

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v2.3.0
8+
hooks:
9+
- id: check-yaml
10+
- id: end-of-file-fixer
11+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
12+
- id: trailing-whitespace
13+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'

BUILDING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Building CircuitPython
33

4-
Welcome to CircuitPython!
4+
Welcome to CircuitPython!
55

66
This document is a quick-start guide only.
77

@@ -28,7 +28,7 @@ This project has a bunch of git submodules. You will need to update them regula
2828
As part of the build process, mpy-cross is needed to compile .py files into .mpy files.
2929
To compile (or recompile) mpy-cross:
3030

31-
make -C mpy-cross
31+
make -C mpy-cross
3232

3333
# Building
3434

@@ -68,7 +68,7 @@ A successful run will say something like
6868

6969
# Debugging
7070

71-
The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and an appropriate GDB.
71+
The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and an appropriate GDB.
7272
Instructions can be found at https://learn.adafruit.com/debugging-the-samd21-with-gdb
7373

7474
If using JLink, you'll need both the `JLinkGDBServer` and `arm-none-eabi-gdb` running.

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
3+
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
4+
5+
SPDX-License-Identifier: CC-BY-4.0
6+
-->
17
# Adafruit Community Code of Conduct
28

39
## Our Pledge
@@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:
4349

4450
The goal of the standards and moderation guidelines outlined here is to build
4551
and maintain a respectful community. We ask that you don’t just aim to be
46-
"technically unimpeachable", but rather try to be your best self.
52+
"technically unimpeachable", but rather try to be your best self.
4753

4854
We value many things beyond technical expertise, including collaboration and
4955
supporting others within our community. Providing a positive experience for
@@ -74,9 +80,9 @@ You may report in the following ways:
7480
In any situation, you may send an email to <[email protected]>.
7581

7682
On the Adafruit Discord, you may send an open message from any channel
77-
to all Community Moderators by tagging @community moderators. You may
78-
also send an open message from any channel, or a direct message to
79-
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
83+
to all Community Moderators by tagging @community moderators. You may
84+
also send an open message from any channel, or a direct message to
85+
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
8086
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
8187

8288
Email and direct message reports will be kept confidential.

Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,37 @@ pseudoxml:
202202
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
203203

204204
# phony target so we always run
205+
.PHONY: all-source
205206
all-source:
206207

207208
locale/circuitpython.pot: all-source
208209
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
209210

211+
# Historically, `make translate` updated the .pot file and ran msgmerge.
212+
# However, this was a frequent source of merge conflicts. Weblate can perform
213+
# msgmerge, so make translate merely update the translation template file.
214+
.PHONY: translate
210215
translate: locale/circuitpython.pot
216+
217+
# Note that normally we rely on weblate to perform msgmerge. This reduces the
218+
# chance of a merge conflict between developer changes (that only add and
219+
# remove source strings) and weblate changes (that only add and remove
220+
# translated strings from po files). However, in case this is legitimately
221+
# needed we preserve a rule to do it.
222+
.PHONY: msgmerge
223+
msgmerge:
211224
for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done
212225

213226
merge-translate:
214227
git merge HEAD 1>&2 2> /dev/null; test $$? -eq 128
215228
rm locale/*~ || true
216-
git checkout --ours -- locale/*
229+
git checkout --theirs -- locale/*
217230
make translate
218231

219-
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
220-
$(PYTHON) tools/check_translations.py $^
232+
.PHONY: check-translate
233+
check-translate:
234+
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
235+
$(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status
221236

222237
stubs:
223238
@mkdir -p circuitpython-stubs

conf.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
# serve to show the default.
1515

1616
import json
17-
import sys
17+
import logging
1818
import os
19+
import subprocess
20+
import sys
21+
import urllib.parse
1922

2023
import recommonmark
21-
import subprocess
2224

2325
# If extensions (or modules to document with autodoc) are in another directory,
2426
# add these directories to sys.path here. If the directory is relative to the
@@ -79,6 +81,9 @@
7981
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
8082
autoapi_template_dir = 'docs/autoapi/templates'
8183
autoapi_python_use_implicit_namespaces = True
84+
autoapi_root = "shared-bindings"
85+
86+
redirects_file = 'docs/redirects.txt'
8287

8388
# The encoding of source files.
8489
#source_encoding = 'utf-8-sig'
@@ -374,5 +379,46 @@
374379
"bus_device": ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
375380
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
376381

382+
# Adapted from sphinxcontrib-redirects
383+
from sphinx.builders import html as builders
384+
385+
TEMPLATE = """<html>
386+
<head><meta http-equiv="refresh" content="0; url=%s"/></head>
387+
</html>
388+
"""
389+
390+
391+
def generate_redirects(app):
392+
path = os.path.join(app.srcdir, app.config.redirects_file)
393+
if not os.path.exists(path):
394+
app.info("Could not find redirects file at '%s'" % path)
395+
return
396+
397+
if not type(app.builder) == builders.StandaloneHTMLBuilder:
398+
logging.warn("The 'sphinxcontib-redirects' plugin is only supported "
399+
"by the 'html' builder. Skipping...")
400+
return
401+
402+
with open(path) as redirects:
403+
for line in redirects.readlines():
404+
from_path, to_path = line.rstrip().split(' ')
405+
406+
logging.debug("Redirecting '%s' to '%s'" % (from_path, to_path))
407+
408+
from_path = os.path.splitext(from_path)[0] + ".html"
409+
to_path_prefix = '..%s' % os.path.sep * (
410+
len(from_path.split(os.path.sep)) - 1)
411+
to_path = to_path_prefix + to_path
412+
413+
redirected_filename = os.path.join(app.builder.outdir, from_path)
414+
redirected_directory = os.path.dirname(redirected_filename)
415+
if not os.path.exists(redirected_directory):
416+
os.makedirs(redirected_directory)
417+
418+
with open(redirected_filename, 'w') as f:
419+
f.write(TEMPLATE % urllib.parse.quote(to_path, '#/'))
420+
377421
def setup(app):
378422
app.add_css_file("customstyle.css")
423+
app.add_config_value('redirects_file', 'redirects', 'env')
424+
app.connect('builder-inited', generate_redirects)

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ All commands will, by default, run with `-E` (forces a rebuild from scratch of d
3434

3535
# will turn OFF the force rebuild
3636
make html FORCE=
37-
37+
3838
# will turn OFF the verbosity
3939
make html VERBOSE=
40-
40+
4141
# will turn OFF the force rebuild and make it doubly verbose when running
4242
make html FORCE= VERBOSE="-v -v"
4343

0 commit comments

Comments
 (0)