diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-20 18:00:44 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-20 18:00:44 +1100 |
commit | 209936880df4d63730ea77cf4b6f84e5f2f56d7c (patch) | |
tree | 3799e168efc951c01d34c088253da895587a4675 /py/mpconfig.h | |
parent | 6e7819ee2ee20ec9f09feb40b68be5973797f874 (diff) |
py/builtinimport: Add compile-time option to disable external imports.
The new option is MICROPY_ENABLE_EXTERNAL_IMPORT and is enabled by default
so that the default behaviour is the same as before. With it disabled
import is only supported for built-in modules, not for external files nor
frozen modules. This allows to support targets that have no filesystem of
any kind and that only have access to pre-supplied built-in modules
implemented natively.
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 b8a96f0b0..e9071df2f 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -405,6 +405,13 @@ /*****************************************************************************/ /* Python internal features */ +// Whether to enable import of external modules +// When disabled, only importing of built-in modules is supported +// When enabled, a port must implement mp_import_stat (among other things) +#ifndef MICROPY_ENABLE_EXTERNAL_IMPORT +#define MICROPY_ENABLE_EXTERNAL_IMPORT (1) +#endif + // Whether to use the POSIX reader for importing files #ifndef MICROPY_READER_POSIX #define MICROPY_READER_POSIX (0) |