diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-05-03 01:47:08 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-05-03 01:47:08 +0300 |
commit | d7da2dba07778fa3c0c7873b7c253bde48066e9c (patch) | |
tree | e03df2d1f0cda9842914a7c752b9b2893ce031c4 /py/mpconfig.h | |
parent | 4c2fa83f2afa1dc9522755261c8a6969857a2031 (diff) |
py/modio: Implement uio.resource_stream(package, resource_path).
The with semantics of this function is close to
pkg_resources.resource_stream() function from setuptools, which
is the canonical way to access non-source files belonging to a package
(resources), regardless of what medium the package uses (e.g. individual
source files vs zip archive). In the case of MicroPython, this function
allows to access resources which are frozen into the executable, besides
accessing resources in the file system.
This is initial stage of the implementation, which actually doesn't
implement "package" part of the semantics, just accesses frozen resources
from "root", or filesystem resource - from current dir.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r-- | py/mpconfig.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 9122c9916..a61d431e5 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -886,6 +886,13 @@ typedef double mp_float_t; #define MICROPY_PY_IO (1) #endif +// Whether to provide "uio.resource_stream()" function with +// the semantics of CPython's pkg_resources.resource_stream() +// (allows to access resources in frozen packages). +#ifndef MICROPY_PY_IO_RESOURCE_STREAM +#define MICROPY_PY_IO_RESOURCE_STREAM (0) +#endif + // Whether to provide "io.FileIO" class #ifndef MICROPY_PY_IO_FILEIO #define MICROPY_PY_IO_FILEIO (0) |