Commit graph

533 commits

Author SHA1 Message Date
a80311d4c0 MP3Decoder: make testable in coverage build
An mp3 decoder (note that this needs `audiocore.get_buffer`, not
enabled on devices):
```py
import sys
import audiomp3
import audiocore

GET_BUFFER_DONE, GET_BUFFER_MORE_DATA, GET_BUFFER_ERROR = range(3)

with audiomp3.MP3Decoder(sys.argv[1]) as decoder, open(sys.argv[2], "wb") as target:

    while True:
        res, samples = audiocore.get_buffer(decoder)
        if res != GET_BUFFER_ERROR:
            target.write(samples)
        if res != GET_BUFFER_MORE_DATA:
            break
```

this doesn't actually add any tests though
2024-05-30 14:22:39 -05:00
Dan Halbert
3f4d9310ff CircuitPython files: replace STATIC with static 2024-05-20 11:02:17 -04:00
Dan Halbert
747b7619ea update headers of most CircuitPython-only files 2024-05-17 14:56:28 -04:00
1be36bd7cb Add floppyio to unix port, test mfm decoding 2024-04-02 15:42:28 -05:00
94123725f7
Add ColorConverter & Palette to coverage build 2024-01-12 10:18:48 -06:00
75be426377
Add "bitmapfilter"
bitmapfilter.morph is taken from openmv's imlib.

It is substantially faster than blur/sharpen implemented in ulab,
by up to 10x. It also avoids making many allocations.
2024-01-05 14:16:00 -06:00
9477574dfc
Add codeop.compile_command
This function in standard Python is a building block for custom REPLs:
```python
from codeop import compile_command

print("Repl in (Circuit-)Python")
ns = {}

PS1="<<< "
PS2=",,, "
command = ""
while True:
    line = input(PS2 if command else PS1)
    if command:
        command = command + "\n" + line
    else:
        command = line
    try:
        if (code := compile_command(command)):
            command = ""
            exec(code, ns)
    except Exception as e:
        command = ""
        print(e)
```
2023-12-14 09:23:23 -06:00
Scott Shawcroft
ca1b680d27
Merge pull request #8696 from jepler/jpegdecoder
Jpegdecoder
2023-12-08 15:35:29 -08:00
bd86b44848
Add JpegDecoder 2023-12-05 12:11:53 -06:00
Bill Sideris
59f0674e98
Disable unix port override, as it's no longer needed 2023-12-04 22:04:10 +02:00
5dc1d389d1
tests: restore getenv_int tests 2023-11-21 08:54:07 -06:00
46bfbad1bb
Add locale.getlocale()
This returns the localization of the running CircuitPython, such as
en_US, fr, etc.

Additional changes are needed in build infrastructure since the
string "en_US" should not appear to be translated in weblate, ever;
instead the value comes from the translation metadata.

Closes: #8602
2023-11-14 21:20:03 -06:00
Scott Shawcroft
be30c12a74
Pass subobject into native subscr
This allows PixelBuf to call transmit after setting a value.

Fixes #8488
2023-10-25 11:44:32 -07:00
Scott Shawcroft
63079c75b0
Re-add passing native methods the subclass instance
Fixes #8488
2023-10-24 16:20:51 -07:00
Scott Shawcroft
53bc6d4bd1
Fix docs build by splitting out support matrix 2023-10-24 16:20:51 -07:00
Scott Shawcroft
e62db5adcd
Fix native property setting from subclass 2023-10-24 16:20:51 -07:00
Scott Shawcroft
168c40e940
Merge pull request #8508 from dhalbert/v1.21-merge
V1.21 merge
2023-10-24 15:36:06 -07:00
Dan Halbert
8017a1ad30 ports/unix VARIANT=coverage fixes 2023-10-20 16:51:04 -04:00
7ab5252cdd
Add CIRCUITPY_MESSAGE_COMPRESSION_LEVEL
to trade compile speed & flash size

Initially enable the faster mode on rp2040 and espressif, where there's
usually plenty of flash available (these advanced techniques save hundreds
to thousands of bytes, which is important on a lot of old samd21 boards
but is a drop in the lake of a 4MB flash chip)
2023-10-20 19:18:18 +01:00
Dan Halbert
4b42a6f4a0 restore old uzlib; remove remaining U and u prefixes 2023-10-19 21:29:57 -04:00
Dan Halbert
367e13c69f change CIRCUITPY change markers to CIRCUITPY-CHANGE 2023-10-19 16:42:36 -04:00
Dan Halbert
f2ebe6839c Initial MicroPython v1.21.0 merge; not compiled yet 2023-10-18 17:49:14 -04:00
Scott Shawcroft
9633c4e78f
Merge remote-tracking branch 'adafruit/main' into v1.20-merge 2023-10-11 11:21:57 -07:00
Scott Shawcroft
2910dea6fd
Almost fix extra_coverage test 2023-10-11 10:04:02 -07:00
Scott Shawcroft
18c03a74dd
Fix a few tests
* Re-enable a couple FATFS configurations we added.
* Remove MICROPY_PY_IO_FILEIO.
* Remove uasyncio from standard unix build.
* Re-add our unicode printing improvements.
2023-10-05 10:59:08 -07:00
542d1571bf
Fix getenv test 2023-10-02 08:56:27 -05:00
499ea3f0e8
Restore unix Makefile functionality 2023-10-02 07:28:20 -05:00
vsfos
1660c78795 unix/main: Fix memory leakage if MICROPY_USE_READLINE is disabled. 2023-10-02 11:44:12 +11:00
Angus Gratton
2fcd28f713 py/mkrules.mk: Don't strip binary if STRIP variable is unset.
This provides a way to build a non-DEBUG host binary that still has symbols
and debug information.

Document this for the unix port, and update a comment in the unix port
Makefile.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-29 13:01:12 +10:00
fb6f4c938c
tweak coverage build configuration 2023-09-22 14:26:51 -05:00
d1ee906afd
fix dependency on generated header 2023-09-22 14:14:07 -05:00
2cc07aef73
dummy RUN_BACKGROUND_TASKS for unix port 2023-09-22 13:39:08 -05:00
87feeab922
fix ringbuf differences 2023-09-22 13:38:56 -05:00
e1fffe67a0
split heap doesn't build yet so don't test it 2023-09-22 10:40:34 -05:00
4902b76129
guard this file against being included twice 2023-09-22 10:40:21 -05:00
e7668ed91d
spelling 2023-09-20 11:23:34 -05:00
2b754b1f6b
spelling 2023-09-20 11:23:28 -05:00
Dan Halbert
2c0fa0f7dc initial merge from v1.20.0; just satisifying conflicts 2023-09-19 11:10:12 -04:00
David Yang
545b94a8f5 unix/modjni: Fix build errors with type definitions and error strings.
- Superfluous comments in MP_DEFINE_CONST_OBJ_TYPE stop correct macro
  expanding.
- MP_ERROR_TEXT now gives mp_rom_error_text_t, but we want plain const
  char *.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2023-09-04 10:22:19 +10:00
David Lechner
ffb43b2dd3 py/modthread: Return thread id from start_new_thread().
In CPython, `_thread.start_new_thread()` returns an ID that is the same ID
that is returned by `_thread.get_ident()`.  The current MicroPython
implementation of `_thread.start_new_thread()` always returns `None`.

This modifies the required functions to return a value. The native thread
id is returned since this can be used for interop with other functions, for
example, `pthread_kill()` on *nix. `_thread.get_ident()` is also modified
to return the native thread id so that the values match and avoids the need
for a separate `native_id` attribute.

Fixes issue #12153.

Signed-off-by: David Lechner <david@pybricks.com>
2023-09-03 18:49:18 +10:00
Jim Mussared
b2b5bcce28 py/profile: Remove the requirement to disable MICROPY_COMP_CONST.
The only reason that const had to be disabled was to make the test output
match CPython when const was involved.  Instead, this commit fixes the test
to handle the lines where const is used.

Also:
- remove the special handling for MICROPY_PERSISTENT_CODE_SAVE in
  unix/mpconfigport.h, and make this automatic.
- move the check for MICROPY_PERSISTENT_CODE_SAVE to where it's used (like
  we do for other similar checks) and add a comment explaining it.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-08-30 10:58:04 +10:00
Dan Halbert
88c22d5052 remove last uses of 'u' prefix 2023-08-22 12:57:47 -04:00
Dan Halbert
bfccb77ec1 asyncio test fixes and asyncio library updates 2023-08-18 13:16:16 -04:00
843fdbb250
Add a missing MP_PROTO_IMPLEMENT 2023-08-15 13:25:25 -05:00
94b89b7e57
enable exception chaining so we can run the test 2023-08-15 11:54:48 -05:00
Dan Halbert
3d48e87e60 jepler: fix 18 tests (redo commit to be correct) 2023-08-14 18:34:32 -04:00
Dan Halbert
545d434239 Revert "jepler: fix 18 tests"
This reverts commit 5ad35004cb.
2023-08-14 18:21:50 -04:00
Dan Halbert
5ad35004cb jepler: fix 18 tests 2023-08-14 17:53:38 -04:00
Dan Halbert
b73f05fe64 turn off viper tests; thanks jepler 2023-08-14 16:43:07 -04:00
Dan Halbert
8cf5b6e707 fixes to unix port support; thanks @jepler 2023-08-14 09:51:52 -04:00