Wykres commitów

1569 Commity (master)

Autor SHA1 Wiadomość Data
Brian Pugh a99b80186d tempfile: Add unit tests for tempfile, and don't use os.path.join. 2022-11-11 13:04:16 +11:00
Brian Pugh 8ce4adf8bf shutil: Add unit tests for shutil. 2022-11-11 13:04:16 +11:00
Brian Pugh 69e8a502dd shutil: Don't allow an empty string in rmtree. 2022-11-11 13:04:14 +11:00
Brian Pugh 4ae896afdc shutil: Fix shutil.rmtree to use os.ilistdir instead of os.walk. 2022-11-11 13:01:23 +11:00
Brian Pugh ee286ed28c tempfile: Add initial tempfile implementation.
With TemporaryDirectory class and mkdtemp function.
2022-11-11 13:00:51 +11:00
robert-hh 2b07820df3 dht: Fix regression importing dht_readinto from pyb.
sys.platform of Pyboard is "pyboard", not "pyb".
2022-11-10 11:13:37 +11:00
Jim Mussared 038b4ac657 unittest: Convert to a package.
This allows a much more natural way of implementing unitttest-discover:
 - unittest provides unittest/__init__.py
 - unittest-discover provides unittest/__main__.py

It also fixes an bug where unittest.py previously detected the presence of
unittest-discover.py by importing an checking for the ImportError. But that
could also be raised by a missing dependency. Now when you run
`micropython -m unittest` without unittest-discover, you get
`ImportError: no module named 'unittest.__main__'`, and without the
required deps, `ImportError: no module named 'argparse'`.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 14:56:34 +11:00
Patrick Joy a14226f7c5 shutil: Add disk_usage function.
Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2022-11-09 14:44:40 +11:00
Jim Mussared c26d77b52e venv: Add a command-line package for creating virtual environments.
Works like "python -m venv path" and creates a rudimentary virtual
environment for the Unix port:
 - sets MICROPYPATH
 - copies the micropython binary to venv/bin/micropython which is in $PATH
 - installs mip & mip-cmdline in the venv

Using the venv is the same as for CPython -- source the activate script to
enter, and call the deactivate function to leave.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:52:03 +11:00
Jim Mussared 143c2937de mip: Set opt=3 by default.
mip will be installed by default on many boards. Make it small.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:43:31 +11:00
Jim Mussared a363ac6b21 micropython/mip: Add command-line functionality for the Unix port.
Moves mip.py to mip/__init__.py, so that the optional (added in this
commit) mip/__main__.py can exist to support:

`micropython -m mip install [--target,--index,--no-mpy] package@version`

"install" works by forwarding the arguments directly to mip.install.

Updates mip to v0.2.0 because of the change in directory structure.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:43:04 +11:00
sandyscott 81c1408a07 aiorepl: Fix ordering of saving previous character.
Duplicate Ctrl-C and LF detection requires this, but it was incorrectly
saving the current value, not the previous.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:36:05 +11:00
sandyscott d6eb5b6f7e aiorepl: Ignore duplicate LFLF after converting CRLF from Windows.
The regular REPL uses the uncooked input, but aiorepl reads from sys.stdin
which is cooked. The result is that if the client sends a CRLF, aiorepl
will see LFLF.

This ignores a second LF in quick succession from the first.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:35:57 +11:00
Jim Mussared 50b7aca171 aioble/client.py: Fix default for the `response` arg to char.write().
- `_FLAG_WRITE` was incorrectly `_FLAGS_WRITE`
- `response` should be defaulted to `None` rather than `False` in order
  to detect that when it is unspecified.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-08 18:57:29 +11:00
iabdalkader 82f6b18b88 espflash: Add a minimal ESP32 bootloader protocol implementation.
This tool implements a subset of the ESP32 ROM bootloader protocol, and
it's mainly intended for updating Nina WiFi firmware from MicroPython, but
can be used to flash any ESP32 chip.
2022-11-08 18:45:22 +11:00
robert-hh 0e25b109c2 dht: Change the sequence for importing dht_readinto.
Check the machine module first, then search in previous places.  This
supports having machine.dht_readinto as the new standard, while still being
backwards compatible.
2022-11-08 18:23:26 +11:00
iabdalkader 900dd1c61b ntptime: Allow overriding default NTP timeout.
The default 1 second timeout is sometimes not enough depending on the host
and network latencies.  This patch makes timeout configurable.
2022-10-26 00:05:19 +11:00
Jim Mussared 8503017e3b aioble: Split into optional components.
This replaces the options that could be specified previously to include
and require.

The `aioble` package now provides everything. For a minimal install, the
individual components can now be installed or require()'ed explicitly.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-06 16:45:15 +11:00
Ian Cotter-Llewellyn 4dc2d5e17f umqtt.robust: Fix check_msg blocking after reconnect.
After `reconnect()`, MQTTClient.socket is blocking by default, and
check_msg() can block.  This commit aims to fix that behaviour by
reimplementing `check_msg()` for umqtt.robust and setting the socket to
non-blocking.

Fixes issue #192.
2022-10-04 12:59:09 +11:00
Meir Armon b50d3462d7 umqtt.simple: Return op from wait_msg() as indication of reception.
Fixes issue #328.
2022-10-04 12:34:31 +11:00
Oliver Joos 9bc0b15f11 unittest: Make AssertRaisesContext store exception for later retrieval.
The statement "with assertRaises(errtype) as ctxt" checks the type of a
raised exception, but did not store the exception into ctxt like unittest
of CPython.  The exception instance is usually used to check its message or
other args.
2022-10-04 12:28:43 +11:00
Andrew Leech 459e13921a os.path: Remove external / ffi dependencies in os.path.
This work was funded by Planet Innovation.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2022-09-30 17:51:06 +10:00
Jim Mussared d0f97fc218 tools/build.py: Make build.py work without f-strings.
Allows running on older CPython versions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29 23:51:03 +10:00
Jim Mussared 5e7bac1161 micropython/mip: Add a new `mip` library for on-device installation.
Riffing on "pip", "mip installs packages".

This is a replacement for the previous `upip` tool for on-device
installation of packages.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29 22:54:32 +10:00
Jim Mussared 58a93f3d7f tools/build.py: Add script for deploying to a static web server.
This populates https://micropython.org/pi/v2 with compiled packages,
suitable for use by `mip` and `mpremote`.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29 22:54:32 +10:00
Jim Mussared 122b68968c uu: Fix dependency on os-path.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-28 00:58:35 +10:00
Andrew Leech eba897420d aioble/server.py: Maintain write order for captured characteristics.
This replaced the per-characteristic queues with a single shared queue,
which means that the characteristics will return from `written()` in the
exact order that the original writes arrived, even if the writes are
occuring across multiple different characteristics.

This work was funded by Planet Innovation.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-27 22:47:30 +10:00
Andrew Leech 0c5880d2e4 aioble/l2cap: Fix psm variable name.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-27 14:28:56 +10:00
Jim Mussared 7602843209 micropython/aiorepl: Initial version of an asyncio REPL.
This provides an async REPL with the following features:
- Run interactive REPL in the background.
- Execute statements using await.
- Simple history.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-26 16:33:24 +10:00
Jim Mussared ad9309b669 os: Import `path` automatically if available.
This matches CPython behavior:

```
>>> import os
>>> os.path.sep
'/'
```

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared f1039fd2f2 collections: Rename collections.* to collections-*.
This is to match the convention for naming "extension" packages.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared c262628a41 os: Rename os.path to os-path.
This is to match the convention for naming "extension" packages.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared 796a5986cd unittest: Move back to python-stdlib.
In order to make this more suitable for non-unix ports, the discovery
functionality is moved to a separate 'extension' module which can be
optionally installed.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 09:57:04 +10:00
Jim Mussared cb88a6a554 argparse: Move back to python-stdlib.
Although this primarily makes sense for the unix port, there's nothing
preventing it being used on any port, and it's written for MicroPython.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 09:57:04 +10:00
Jim Mussared 8a03f7b91f python-stdlib: Remove pystone (and variants).
We have a more useful version of this in the main repo's performance tests.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-10 01:47:37 +10:00
Jim Mussared d080924d12 aioble/multitests: Add descriptor multitest.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared e58b609572 aioble/client.py: Make read/write events work for descriptors.
Descriptors were missing common initialisation for events shared with
characteristics.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 765f14b501 aioble/server.py: Fix registration for descriptors.
This allows a server to register descriptors, which was previously not
fully implemented.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 64e752cce6 aioble/client.py: Use characteristic end handle (when available).
The `bluetooth` module replaced the def_handle field with end_handle
in the characteristic result IRQ. Use this when querying for
descriptors.

In the case where this is not available (older versions of micropython)
continue the existing behavior of searching just past the value handle,
although decrease this to +2 to avoid finding other characteristic's
descriptors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 58f8bec54d micropython/net: Add "ntptime" client from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:26:12 +10:00
Jim Mussared cc2cdeb94b micropython/net: Add "webrepl" server from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:25:21 +10:00
Jim Mussared cf5ed97b4d micropython/drivers: Move "sdcard" driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:57 +10:00
Jim Mussared 33b5132312 micropython/drivers: Move "lps22h" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:56 +10:00
Jim Mussared b3e443ca8e micropython/drivers: Move "hts221" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:55 +10:00
Jim Mussared a336c29cc5 micropython/drivers: Move "dx18x20" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:54 +10:00
Jim Mussared 0382c9cffa micropython/drivers: Move "dht" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:53 +10:00
Jim Mussared c1c0eb0c39 micropython/drivers: Move "nrf24l01" radio driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:52 +10:00
Jim Mussared f46401f849 micropython/drivers: Move "neopixel" led driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:50 +10:00
Jim Mussared 75d129b96f micropython/drivers: Move "lsm6sox" imu driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:48 +10:00
Jim Mussared fd84cd92f3 micropython/drivers: Move "lsm9ds1" imu driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:44 +10:00