summaryrefslogtreecommitdiff
path: root/ports/unix/main.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-03-09 12:32:44 +1100
committerDamien George <damien@micropython.org>2022-03-09 21:13:57 +1100
commit2b409ef8a46015f8f3bd20bc44e644637dbe9bd3 (patch)
treea28650be47592a6b75047b74095d7d74006d1e15 /ports/unix/main.c
parentade2720e55e5960f6667d952c4482a369747e3a4 (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 'ports/unix/main.c')
-rw-r--r--ports/unix/main.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 2769f3319..bde867f8c 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -723,38 +723,6 @@ MP_NOINLINE int main_(int argc, char **argv) {
return ret & 0xff;
}
-#if !MICROPY_VFS
-uint mp_import_stat(const char *path) {
- struct stat st;
- if (stat(path, &st) == 0) {
- if (S_ISDIR(st.st_mode)) {
- return MP_IMPORT_STAT_DIR;
- } else if (S_ISREG(st.st_mode)) {
- return MP_IMPORT_STAT_FILE;
- }
- }
- return MP_IMPORT_STAT_NO_EXIST;
-}
-
-#if MICROPY_PY_IO
-// Factory function for I/O stream classes, only needed if generic VFS subsystem isn't used.
-// Note: buffering and encoding are currently ignored.
-mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kwargs) {
- enum { ARG_file, ARG_mode };
- STATIC const mp_arg_t allowed_args[] = {
- { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE} },
- { MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_r)} },
- { MP_QSTR_buffering, MP_ARG_INT, {.u_int = -1} },
- { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
- };
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args, pos_args, kwargs, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- return mp_vfs_posix_file_open(&mp_type_textio, args[ARG_file].u_obj, args[ARG_mode].u_obj);
-}
-MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
-#endif
-#endif
-
void nlr_jump_fail(void *val) {
fprintf(stderr, "FATAL: uncaught NLR %p\n", val);
exit(1);