Skip to content

Commit 90a09db

Browse files
committed
Merge branch 'master' of github.com:adafruit/circuitpython
2 parents 9f20261 + 5429339 commit 90a09db

20 files changed

+98
-290
lines changed

docs/Makefile renamed to Makefile

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ PYTHON = python3
66
SPHINXOPTS =
77
SPHINXBUILD = sphinx-build
88
PAPER =
9-
BUILDDIR = build/$(MICROPY_PORT)
10-
CPYDIFFDIR = ../tools
11-
CPYDIFF = gen-cpydiff.py
12-
GENRSTDIR = genrst
9+
# path to build the generated docs
10+
BUILDDIR = _build
11+
# path to source files to process
12+
SOURCEDIR = .
13+
# path to conf.py
14+
CONFDIR = .
1315
# Run "make FORCE= ..." to avoid rebuilding from scratch (and risk
1416
# producing incorrect docs).
1517
FORCE = -E
18+
VERBOSE = -v
1619

1720
# User-friendly check for sphinx-build
1821
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
@@ -22,9 +25,10 @@ endif
2225
# Internal variables.
2326
PAPEROPT_a4 = -D latex_paper_size=a4
2427
PAPEROPT_letter = -D latex_paper_size=letter
25-
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
28+
BASEOPTS = -c $(CONFDIR) $(PAPEROPT_$(PAPER)) $(FORCE) $(VERBOSE) $(SPHINXOPTS) $(SOURCEDIR)
29+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
2630
# the i18n builder cannot share the environment and doctrees with the others
27-
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
31+
I18NSPHINXOPTS = $(BASEOPTS)
2832

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

@@ -52,19 +56,12 @@ help:
5256
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
5357
@echo " linkcheck to check all external links for integrity"
5458
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
55-
@echo " cpydiff to generate the MicroPython differences from CPython"
5659

5760
clean:
5861
rm -rf $(BUILDDIR)/*
59-
rm -f $(GENRSTDIR)/*
6062

61-
cpydiff:
62-
@echo "Generating MicroPython Differences."
63-
rm -f $(GENRSTDIR)/*
64-
cd $(CPYDIFFDIR) && $(PYTHON) $(CPYDIFF)
65-
66-
html: cpydiff
67-
$(SPHINXBUILD) $(FORCE) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
63+
html:
64+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
6865
@echo
6966
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
7067

@@ -117,30 +114,34 @@ epub:
117114
@echo
118115
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
119116

120-
latex: cpydiff
117+
latex:
121118
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
122119
@echo
123120
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
124121
@echo "Run \`make' in that directory to run these through (pdf)latex" \
125122
"(use \`make latexpdf' here to do that automatically)."
126123

127-
latexpdf: cpydiff
128-
$(SPHINXBUILD) $(FORCE) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
124+
# seems to be malfunctioning
125+
latexpdf:
126+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
129127
@echo "Running LaTeX files through pdflatex..."
130128
$(MAKE) -C $(BUILDDIR)/latex all-pdf
131129
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
132130

133-
latexpdfja: cpydiff
131+
# seems to be malfunctioning
132+
latexpdfja:
134133
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
135134
@echo "Running LaTeX files through platex and dvipdfmx..."
136135
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
137136
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
138137

138+
# seems to be malfunctioning
139139
text:
140140
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
141141
@echo
142142
@echo "Build finished. The text files are in $(BUILDDIR)/text."
143143

144+
# seems to be malfunctioning
144145
man:
145146
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
146147
@echo

README.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ Designed for CircuitPython
3131
~~~~~~~~~~~~~~~~~~~~~~~~~~
3232

3333
- `Adafruit CircuitPlayground
34-
Express <https://www.adafruit.com/product/3333>`__
34+
Express <https://www.adafruit.com/product/3333>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart>`__)
3535
- `Adafruit Feather M0
36-
Express <https://www.adafruit.com/product/3403>`__
37-
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`__
38-
- `Adafruit Gemma M0 <https://www.adafruit.com/product/3501>`__
36+
Express <https://www.adafruit.com/product/3403>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/kattni-circuitpython>`__)
37+
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`_ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/circuitpython>`__)
38+
- `Adafruit Gemma M0 <https://www.adafruit.com/product/3501>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-gemma-m0/circuitpython>`__)
39+
- `Adafruit ItsyBitsy M0 Express <https://www.adafruit.com/product/3727>`_ (no CircuitPython Guide yet!)
40+
- `Adafruit Trinket M0 <https://www.adafruit.com/product/3500>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/circuitpython>`__)
41+
- `Adafruit Metro M4 <https://www.adafruit.com/product/3382>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/overview>`__)
3942

4043
Other
4144
~~~~~
@@ -69,8 +72,15 @@ System <https://learn.adafruit.com/>`__ under the `CircuitPython
6972
category <https://learn.adafruit.com/category/circuitpython>`__ and
7073
`MicroPython
7174
category <https://learn.adafruit.com/category/micropython>`__. An API
72-
reference is also available on `Read the
73-
Docs <http://circuitpython.readthedocs.io/en/latest/?>`__.
75+
reference is also available on `Read the Docs
76+
<http://circuitpython.readthedocs.io/en/latest/?>`__. A collection of awesome
77+
resources can be found at `Awesome CircuitPython <https://github.com/adafruit/awesome-circuitpython>`__.
78+
79+
Specifically useful documentation when starting out:
80+
81+
- `Welcome to CircuitPython <https://learn.adafruit.com/welcome-to-circuitpython>`__
82+
- `CircuitPython Essentials <https://learn.adafruit.com/circuitpython-essentials>`__
83+
- `Example Code <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/CircuitPython_Essentials>`__
7484

7585
Contributing
7686
------------

docs/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ preferably in a virtualenv:
2222

2323
In `circuitpython/`, build the docs:
2424

25-
sphinx-build -v -b html . _build/html
25+
make html
2626

2727
You'll find the index page at `_build/html/index.html`.
28+
29+
### More flexibility
30+
31+
Running `make` by itself will list out the multiple doc generating commands available.
32+
33+
All commands will, by default, run with `-E` (forces a rebuild from scratch of docs) and `-v` (verbosity level 1). This can be customized as desired:
34+
35+
# will turn OFF the force rebuild
36+
make html FORCE=
37+
38+
# will turn OFF the verbosity
39+
make html VERBOSE=
40+
41+
# will turn OFF the force rebuild and make it doubly verbose when running
42+
make html FORCE= VERBOSE="-v -v"
43+
44+
You can also pass other options to sphinx by using `SPHINXOPTS`.
45+
46+
make html SPHINXOPTS="-T"
47+
48+
For more flexibility and customization, take a look at the Makefile for all variables you can pass in and overwrite.

docs/library/ucollections.rst renamed to docs/library/collections.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
:mod:`ucollections` -- collection and container types
1+
:mod:`collections` -- collection and container types
22
=====================================================
33

44
.. include:: ../templates/unsupported_in_circuitpython.inc
55

6-
.. module:: ucollections
6+
.. module:: collections
77
:synopsis: collection and container types
88

99
|see_cpython_module| :mod:`cpython:collections`.
@@ -24,7 +24,7 @@ Classes
2424
a string with space-separated field named (but this is less efficient).
2525
Example of use::
2626

27-
from ucollections import namedtuple
27+
from collections import namedtuple
2828

2929
MyTuple = namedtuple("MyTuple", ("id", "name"))
3030
t1 = MyTuple(1, "foo")
@@ -38,7 +38,7 @@ Classes
3838
added. When ordered dict is iterated over, keys/items are returned in
3939
the order they were added::
4040

41-
from ucollections import OrderedDict
41+
from collections import OrderedDict
4242

4343
# To make benefit of ordered keys, OrderedDict should be initialized
4444
# from sequence of (key, value) pairs.

docs/library/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Python standard libraries and micro-libraries
2121
gc.rst
2222
sys.rst
2323
binascii.rst
24-
ucollections.rst
24+
collections.rst
2525
uerrno.rst
2626
hashlib.rst
2727
uheapq.rst

ports/atmel-samd/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ extern const struct _mp_obj_module_t usb_hid_module;
188188
#define MICROPY_PY_BUILTINS_FROZENSET (1)
189189
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
190190
#define MICROPY_PY_BUILTINS_REVERSED (1)
191+
#define MICROPY_PY_UERRNO (1)
192+
#define MICROPY_PY_UERRNO_ERRORCODE (0)
191193
#define MICROPY_PY_URE (1)
192194
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
193195
#define MICROPY_PY_FRAMEBUF (1)

py/modcollections.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#if MICROPY_PY_COLLECTIONS
3030

3131
STATIC const mp_rom_map_elem_t mp_module_collections_globals_table[] = {
32-
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ucollections) },
32+
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_collections) },
3333
{ MP_ROM_QSTR(MP_QSTR_namedtuple), MP_ROM_PTR(&mp_namedtuple_obj) },
3434
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
3535
{ MP_ROM_QSTR(MP_QSTR_OrderedDict), MP_ROM_PTR(&mp_type_ordereddict) },

py/moduerrno.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ const mp_obj_module_t mp_module_uerrno = {
100100
};
101101

102102
qstr mp_errno_to_str(mp_obj_t errno_val) {
103+
// For commonly encountered errors, return human readable strings
104+
if (MP_OBJ_IS_SMALL_INT(errno_val)) {
105+
switch (MP_OBJ_SMALL_INT_VALUE(errno_val)) {
106+
case EPERM: return MP_QSTR_Permission_space_denied;
107+
case ENOENT: return MP_QSTR_No_space_such_space_file_slash_directory;
108+
case EIO: return MP_QSTR_Input_slash_output_space_error;
109+
case EACCES: return MP_QSTR_Permission_space_denied;
110+
case EEXIST: return MP_QSTR_File_space_exists;
111+
case ENODEV: return MP_QSTR_Unsupported_space_operation;
112+
case EINVAL: return MP_QSTR_Invalid_space_argument;
113+
}
114+
}
115+
116+
// Otherwise, return the Exxxx string for that error code
103117
#if MICROPY_PY_UERRNO_ERRORCODE
104118
// We have the errorcode dict so can do a lookup using the hash map
105119
mp_map_elem_t *elem = mp_map_lookup((mp_map_t*)&errorcode_dict.map, errno_val, MP_MAP_LOOKUP);

py/objmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
151151
{ MP_ROM_QSTR(MP_QSTR_uio), MP_ROM_PTR(&mp_module_io) },
152152
#endif
153153
#if MICROPY_PY_COLLECTIONS
154-
{ MP_ROM_QSTR(MP_QSTR_ucollections), MP_ROM_PTR(&mp_module_collections) },
154+
{ MP_ROM_QSTR(MP_QSTR_collections), MP_ROM_PTR(&mp_module_collections) },
155155
#endif
156156
#if MICROPY_PY_STRUCT
157157
{ MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) },

tests/basics/class_store_class.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
try:
66
from collections import namedtuple
77
except ImportError:
8-
try:
9-
from ucollections import namedtuple
10-
except ImportError:
11-
print("SKIP")
12-
raise SystemExit
8+
print("SKIP")
9+
raise SystemExit
1310

1411
import skip_if
1512
skip_if.no_cpython_compat()

0 commit comments

Comments
 (0)