summaryrefslogtreecommitdiff
path: root/ports/unix
AgeCommit message (Collapse)Author
2020-03-17ulab: rename enable macro so it appears in the support matrixJeff Epler
2020-03-03Merge remote-tracking branch 'origin/master' into ulabJeff Epler
2020-03-01Makefiles: add targets to build unix port, mpy-cross for fuzzingJeff Epler
This assumes you have properly install afl-fuzz with afl-clang-fast. Tested with AFLplusplus 2.60c-75-g2c6847b.
2020-02-27ulab: Incorporate itJeff Epler
2020-02-27unix port: add help(), help('modules')Jeff Epler
2019-12-04protocols: Allow them to be (optionally) type-safeJeff Epler
Protocols are nice, but there is no way for C code to verify whether a type's "protocol" structure actually implements some particular protocol. As a result, you can pass an object that implements the "vfs" protocol to one that expects the "stream" protocol, and the opposite of awesomeness ensues. This patch adds an OPTIONAL (but enabled by default) protocol identifier as the first member of any protocol structure. This identifier is simply a unique QSTR chosen by the protocol designer and used by each protocol implementer. When checking for protocol support, instead of just checking whether the object's type has a non-NULL protocol field, use `mp_proto_get` which implements the protocol check when possible. The existing protocols are now named: protocol_framebuf protocol_i2c protocol_pin protocol_stream protocol_spi protocol_vfs (most of these are unused in CP and are just inherited from MP; vfs and stream are definitely used though) I did not find any crashing examples, but here's one to give a flavor of what is improved, using `micropython_coverage`. Before the change, the vfs "ioctl" protocol is invoked, and the result is not intelligible as json (but it could have resulted in a hard fault, potentially): >>> import uos, ujson >>> u = uos.VfsPosix('/tmp') >>> ujson.load(u) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: syntax error in JSON After the change, the vfs object is correctly detected as not supporting the stream protocol: >>> ujson.load(p) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: stream operation not supported
2019-03-12Fix unix build by using safe mode stubScott Shawcroft
2019-02-21Fix unix build by using filesystem stubScott Shawcroft
2019-01-18Fix unix buildScott Shawcroft
2019-01-18More make_new fixes for unix buildScott Shawcroft
2018-12-07Stub out serial_write as wellScott Shawcroft
2018-12-06Fix unixScott Shawcroft
2018-11-30A few tweaks based on review feedbackScott Shawcroft
2018-11-30Add support for adding release info into adafruit/circuitpython-orgScott Shawcroft
This also changes the build script to python with better output.
2018-08-16Fix unix coverage and update translations.Scott Shawcroft
2018-08-16Fix nrf and unixScott Shawcroft
2018-08-07Support internationalisation.Scott Shawcroft
2018-07-28merge finishedDan Halbert
2018-07-11WIP: after merge; before testingDan Halbert
2018-06-18tests/unix/extra_coverage: Don't test stream objs with NULL write fun.Damien George
This behaviour of a NULL write C method on a stream that uses the write adaptor objects is no longer supported. It was only ever used by the coverage build for testing the fail path of mp_get_stream_raise().
2018-06-12ports: Enable IOBase on unix, stm32, esp8266 and esp32.Damien George
It's a core feature, in particular required for user-streams with uasyncio.
2018-06-12ports: Call gc_sweep_all() when doing a soft reset.Damien George
This calls finalisers of things like files and sockets to cleanly close them.
2018-06-06unix/moduos_vfs: Add missing uos functions from traditional uos module.Damien George
Now that the coverage build has fully switched to the VFS sub-system these functions were no longer available, so add them to the uos_vfs module. Also, vfs_open is no longer needed, it's available as the built-in open.
2018-06-06unix: Support MICROPY_VFS_POSIX and enable it in coverage build.Damien George
The unix coverage build is now switched fully to the VFS implementation, ie the uos module is the uos_vfs module. For example, one can now sandbox uPy to their home directory via: $ ./micropython_coverage >>> import uos >>> uos.umount('/') # unmount existing root VFS >>> vfs = uos.VfsPosix('/home/user') # create new POSIX VFS >>> uos.mount(vfs, '/') # mount new POSIX VFS at root Some filesystem/OS features may no longer work with the coverage build due to this change, and these need to be gradually fixed. The standard unix port remains unchanged, it still uses the traditional uos module which directly accesses the underlying host filesystem.
2018-05-22ports: Enable MICROPY_PY_BUILTINS_ROUND_INT on selected ports.Damien George
2018-04-10py/stream: Switch stream close operation from method to ioctl.Damien George
This patch moves the implementation of stream closure from a dedicated method to the ioctl of the stream protocol, for each type that implements closing. The benefits of this are: 1. Rounds out the stream ioctl function, which already includes flush, seek and poll (among other things). 2. Makes calling mp_stream_close() on an object slightly more efficient because it now no longer needs to lookup the close method and call it, rather it just delegates straight to the ioctl function (if it exists). 3. Reduces code size and allows future types that implement the stream protocol to be smaller because they don't need a dedicated close method. Code size reduction is around 200 bytes smaller for x86 archs and around 30 bytes smaller for the bare-metal archs.
2018-03-31Merge pull request #729 from jepler/tests-parallel-circuitpythonScott Shawcroft
Optionally parallelize the testsuite
2018-03-31ports/unix/Makefile: parallelize testsJeff Epler
2018-03-27Add VfsFat.label propertyJeff Epler
These allow accessing the filesystem label. For instance, in boot.py, you can set the label on the built-in storage with: storage.remount('/', False) storage.getmount('/').label = "NEWLABEL" storage.remount('/', True) Users with multiple CIRCUITPY boards may find it desirable to choose a different label for each board they own.
2018-03-08unix/coverage: Allow coverage tests to pass with debugging disabled.Damien George
2018-03-02tests: Move heap-realloc-while-locked test from C to Python.Damien George
This test for calling gc_realloc() while the GC is locked can be done in pure Python, so better to do it that way since it can then be tested on more ports.
2018-03-01tests/unix: Add coverage tests for various GC calls.Damien George
2018-02-27tests/unix: Add coverage test for VM executing invalid bytecode.Damien George
2018-02-25tests/unix: Add coverage tests for mpz_set_from_float, mpz_mul_inpl.Damien George
These new tests cover cases that can't be reached from Python and get coverage of py/mpz.c to 100%. These "unreachable from Python" pieces of code could be removed but they form an integral part of the mpz C API and may be useful for non-Python usage of mpz.
2018-02-21ports: Enable ucollections.deque on relevant ports.Damien George
These ports are all capable of running uasyncio.
2018-02-14unix/mpconfigport_coverage: Enable range (in)equality comparison.Damien George
2018-02-14unix/Makefile,embedding/Makefile: Remove obsolete use of STMHAL_SRC_C.Damien George
2018-02-08.travis.yml,ports/unix/Makefile: Add coverage test for script via stdin.Damien George
2018-02-08tests/unix: Add coverage test for calling mp_obj_new_bytearray.Damien George
2017-12-19unix/mpconfigport_coverage.h: Enable MICROPY_PY_IO_RESOURCE_STREAM.Damien George
Where possible it's important to test all code in the code base.
2017-12-19tests/unix: Add test for printf with %lx format.Damien George
2017-12-16unix/mpconfigport.h: Allow to override stackless options from commandline.Paul Sokolovsky
2017-12-16unix/Makefile: coverage: Allow user to pass CFLAGS_EXTRA.Paul Sokolovsky
This build sets CFLAGS_EXTRA itself, but preserve user's value as passed on make command line/etc.
2017-12-11unix: Add support for using the Python stack.Damien George
2017-12-10unix/mpconfigport: Disable uio.resource_stream().Paul Sokolovsky
This function was implemented as an experiment, and was enabled only in unix port. To remind, it allows to access arbitrary files frozen as source modules (vs bytecode). However, further experimentation showed that the same functionality can be implemented with frozen bytecode. The process requires more steps, but with suitable toolset it doesn't matter patch. This process is: 1. Convert binary files into "Python resource module" with tools/mpy_bin2res.py. 2. Freeze as the bytecode. 3. Use micropython-lib's pkg_resources.resource_stream() to access it. In other words, the extra step is using tools/mpy_bin2res.py (because there would be wrapper for uio.resource_stream() anyway). Going frozen bytecode route allows more flexibility, and same/additional efficiency: 1. Frozen source support can be disabled altogether for additional code savings. 2. Resources could be also accessed as a buffer, not just as a stream. There're few caveats too: 1. It wasn't actually profiled the overhead of storing a resource in "Python resource module" vs storing it directly, but it's assumed that overhead is small. 2. The "efficiency" claim above applies to the case when resource file is frozen as the bytecode. If it's not, it actually will take a lot of RAM on loading. But in this case, the resource file should not be used (i.e. generated) in the first place, and micropython-lib's pkg_resources.resource_stream() implementation has the appropriate fallback to read the raw files instead. This still poses some distribution issues, e.g. to deployable to baremetal ports (which almost certainly would require freezeing as the bytecode), a distribution package should include the resource module. But for non-freezing deployment, presense of resource module will lead to memory inefficiency. All the discussion above reminds why uio.resource_stream() was implemented in the first place - to address some of the issues above. However, since then, frozen bytecode approach seems to prevail, so, while there're still some issues to address with it, this change is being made. This change saves 488 bytes for the unix x86_64 port.
2017-11-16py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.Damien George
This patch simplifies the str creation API to favour the common case of creating a str object that is not forced to be interned. To force interning of a new str the new mp_obj_new_str_via_qstr function is added, and should only be used if warranted. Apart from simplifying the mp_obj_new_str function (and making it have the same signature as mp_obj_new_bytes), this patch also reduces code size by a bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
2017-11-12extmod/moduhashlib: Enable SHA1 hashing when using "mbedtls" library.Christopher Cooper
The SHA1 hashing functionality is provided via the "axtls" library's implementation, and hence is unavailable when the "axtls" library is not being used. This change provides the same SHA1 hashing functionality when using the "mbedtls" library by using its implementation instead.
2017-11-12py/objnamedtuple: Add _asdict function if OrderedDict is supportedstijn
2017-11-07unix/moduselect: Fix nanbox build after adding .dump() method.Paul Sokolovsky
2017-11-07unix/moduselect: Add .dump() method for debugging.Paul Sokolovsky
Commented out by default.