Skip to content

Commit 0311c34

Browse files
authored
Merge pull request #21 from adafruit/main
Pull from adafruit main
2 parents 1f75953 + 8e77981 commit 0311c34

File tree

212 files changed

+9438
-3465
lines changed

Some content is hidden

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

212 files changed

+9438
-3465
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 2 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,12 +73,19 @@ 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
@@ -253,6 +260,7 @@ jobs:
253260
- "pca10100"
254261
- "pewpew10"
255262
- "pewpew_m4"
263+
- "picoplanet"
256264
- "pirkey_m0"
257265
- "pitaya_go"
258266
- "pyb_nano_v2"

.gitignore

Lines changed: 6 additions & 1 deletion
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,3 +80,8 @@ TAGS
8080
*.mo
8181

8282
.vscode
83+
84+
# Python Virtual Environments
85+
####################
86+
.venv
87+
.env

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,6 @@
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

.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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ stubs:
245245
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
246246
@$(PYTHON) setup.py -q sdist
247247

248+
.PHONY: check-stubs
249+
check-stubs: stubs
250+
MYPYPATH=$(STUBDIR) mypy --strict $(STUBDIR)
251+
248252
update-frozen-libraries:
249253
@echo "Updating all frozen libraries to latest tagged version."
250254
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done

conf.py

Lines changed: 55 additions & 2 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
@@ -84,6 +87,7 @@
8487
autoapi_add_toctree_entry = False
8588
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members', 'show-module-summary']
8689
autoapi_template_dir = 'docs/autoapi/templates'
90+
autoapi_python_class_content = "both"
8791
autoapi_python_use_implicit_namespaces = True
8892
autoapi_root = "shared-bindings"
8993

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

111133
# The language for content autogenerated by Sphinx. Refer to documentation
112134
# for a list of supported languages.
@@ -423,7 +445,38 @@ def generate_redirects(app):
423445
with open(redirected_filename, 'w') as f:
424446
f.write(TEMPLATE % urllib.parse.quote(to_path, '#/'))
425447

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

docs/autoapi/templates/python/module.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
1919
{% if visible_subpackages %}
2020
.. toctree::
21-
:titlesonly:
22-
:maxdepth: 3
21+
:maxdepth: 2
2322

2423
{% for subpackage in visible_subpackages %}
2524
{{ subpackage.short_name }}/index.rst

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sphinx<3
1+
sphinx<4
22
recommonmark==0.6.0
33
sphinxcontrib-svg2pdfconverter==0.1.0
44
astroid

docs/rstjinja.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@ def rstjinja(app, docname, source):
66
Render our pages as a jinja template for fancy templating goodness.
77
"""
88
# Make sure we're outputting HTML
9-
if app.builder.format != 'html':
9+
if app.builder.format not in ("html", "latex"):
1010
return
1111

1212
# we only want our one jinja template to run through this func
1313
if "shared-bindings/support_matrix" not in docname:
1414
return
1515

16-
src = source[0]
16+
src = rendered = source[0]
1717
print(docname)
18-
rendered = app.builder.templates.render_string(
19-
src, app.config.html_context
20-
)
18+
19+
if app.builder.format == "html":
20+
rendered = app.builder.templates.render_string(
21+
src, app.config.html_context
22+
)
23+
else:
24+
from sphinx.util.template import BaseRenderer
25+
renderer = BaseRenderer()
26+
rendered = renderer.render_string(
27+
src,
28+
app.config.html_context
29+
)
30+
2131
source[0] = rendered
2232

2333
def setup(app):

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
520520
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
521521
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
522522
if (index >= arr_sz) {
523-
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
523+
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_struct);
524524
}
525525

526526
if (t->len == 2) {

extmod/vfs_fat_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const byte fresult_to_errno_table[20] = {
4242

4343
STATIC void file_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
4444
(void)kind;
45-
mp_printf(print, "<io.%s %p>", mp_obj_get_type_str(self_in), MP_OBJ_TO_PTR(self_in));
45+
mp_printf(print, "<io.%q %p>", mp_obj_get_type_qstr(self_in), MP_OBJ_TO_PTR(self_in));
4646
}
4747

4848
STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {

extmod/vfs_posix_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
3434
STATIC void vfs_posix_file_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
3535
(void)kind;
3636
mp_obj_vfs_posix_file_t *self = MP_OBJ_TO_PTR(self_in);
37-
mp_printf(print, "<io.%s %d>", mp_obj_get_type_str(self_in), self->fd);
37+
mp_printf(print, "<io.%q %d>", mp_obj_get_type_qstr(self_in), self->fd);
3838
}
3939

4040
mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_obj_t mode_in) {

lib/libm/ef_rem_pio2.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
3636
*/
3737
#ifdef __STDC__
38-
static const __int32_t two_over_pi[] = {
38+
static const __uint8_t two_over_pi[] = {
3939
#else
40-
static __int32_t two_over_pi[] = {
40+
static __uint8_t two_over_pi[] = {
4141
#endif
4242
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
4343
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
@@ -145,6 +145,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
145145
return -1;
146146
}
147147
}
148+
#if CIRCUITPY_FULL_BUILD
148149
if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */
149150
t = fabsf(x);
150151
n = (__int32_t) (t*invpio2+half);
@@ -180,6 +181,11 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
180181
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
181182
else return n;
182183
}
184+
#else
185+
// Suppress "defined but not used" diagnostics
186+
(void) j; (void) fn; (void) r; (void) t; (void) w; (void) pio2_3t;
187+
(void) pio2_3; (void) invpio2; (void)half; (void)npio2_hw;
188+
#endif
183189
/*
184190
* all other (large) arguments
185191
*/

lib/libm/fdlibm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extern float __ieee754_scalbf __P((float,float));
188188
extern float __kernel_sinf __P((float,float,int));
189189
extern float __kernel_cosf __P((float,float));
190190
extern float __kernel_tanf __P((float,float,int));
191-
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __int32_t*));
191+
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __uint8_t*));
192192

193193
/* A union which permits us to convert between a float and a 32 bit
194194
int. */

lib/libm/kf_rem_pio2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ two8 = 2.5600000000e+02, /* 0x43800000 */
6262
twon8 = 3.9062500000e-03; /* 0x3b800000 */
6363

6464
#ifdef __STDC__
65-
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)
65+
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __uint8_t *ipio2)
6666
#else
6767
int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
68-
float x[], y[]; int e0,nx,prec; __int32_t ipio2[];
68+
float x[], y[]; int e0,nx,prec; __uint8_t ipio2[];
6969
#endif
7070
{
7171
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;

0 commit comments

Comments
 (0)