diff options
| author | Damien George <damien@micropython.org> | 2022-03-09 12:32:44 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-03-09 21:13:57 +1100 |
| commit | 2b409ef8a46015f8f3bd20bc44e644637dbe9bd3 (patch) | |
| tree | a28650be47592a6b75047b74095d7d74006d1e15 /extmod/moduos.c | |
| parent | ade2720e55e5960f6667d952c4482a369747e3a4 (diff) | |
unix/moduos: Convert module to use extmod version.
All variants now use extmod/moduos.c as their uos module implementation.
In particular this means they all have MICROPY_VFS enabled and use VfsPosix
for their filesystem.
As part of this, the available functions in uos become more consistent with
other ports:
- coverage variant gets uos.urandom
- minimal and standard variant get: unlink, chdir, getcwd, listdir
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/moduos.c')
| -rw-r--r-- | extmod/moduos.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/extmod/moduos.c b/extmod/moduos.c index 0ec38bff8..ed278dd54 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -40,6 +40,10 @@ #include "extmod/vfs_lfs.h" #endif +#if MICROPY_VFS_POSIX +#include "extmod/vfs_posix.h" +#endif + #if MICROPY_PY_UOS_UNAME #include "genhdr/mpversion.h" #endif @@ -101,12 +105,20 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + #if MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mp_uos_getenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mp_uos_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mp_uos_unsetenv_obj) }, + #endif #if MICROPY_PY_UOS_SEP { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, #endif #if MICROPY_PY_UOS_SYNC { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, #endif + #if MICROPY_PY_UOS_SYSTEM + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mp_uos_system_obj) }, + #endif #if MICROPY_PY_UOS_UNAME { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, #endif @@ -135,6 +147,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_PY_UOS_DUPTERM_NOTIFY { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&mp_uos_dupterm_notify_obj) }, #endif + #if MICROPY_PY_UOS_ERRNO + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_uos_errno_obj) }, + #endif #if MICROPY_VFS { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, @@ -149,6 +164,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_VFS_LFS2 { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, #endif + #if MICROPY_VFS_POSIX + { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, + #endif #endif }; STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); |
