diff --git a/python/Makefile b/python/Makefile index 14a556cd8..2792fc9dc 100644 --- a/python/Makefile +++ b/python/Makefile @@ -148,6 +148,8 @@ port_src += $(addprefix python/port/,\ mod/matplotlib/pyplot/plot_view.cpp \ mod/time/modtime.c \ mod/time/modtime_table.c \ + mod/os/modos.c \ + mod/os/modos_table.c \ mod/turtle/modturtle.cpp \ mod/turtle/modturtle_table.c \ mod/turtle/turtle.cpp \ diff --git a/python/port/genhdr/qstrdefs.in.h b/python/port/genhdr/qstrdefs.in.h index 4dbcf5453..1c438a66c 100644 --- a/python/port/genhdr/qstrdefs.in.h +++ b/python/port/genhdr/qstrdefs.in.h @@ -526,3 +526,5 @@ Q(SEEK_SET) Q(SEEK_CUR) Q(SEEK_END) +Q(os) + diff --git a/python/port/mod/os/modos.cpp b/python/port/mod/os/modos.cpp new file mode 100644 index 000000000..9ef8d03d1 --- /dev/null +++ b/python/port/mod/os/modos.cpp @@ -0,0 +1,3 @@ +extern "C" { +#include "modos.h" +} diff --git a/python/port/mod/os/modos.h b/python/port/mod/os/modos.h new file mode 100644 index 000000000..023ac9eaa --- /dev/null +++ b/python/port/mod/os/modos.h @@ -0,0 +1 @@ +#include diff --git a/python/port/mod/os/modos_table.c b/python/port/mod/os/modos_table.c new file mode 100644 index 000000000..1bbe09b4f --- /dev/null +++ b/python/port/mod/os/modos_table.c @@ -0,0 +1,12 @@ +#include "modos.h" + +STATIC const mp_rom_map_elem_t modos_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_os) }, +}; + +STATIC MP_DEFINE_CONST_DICT(modos_module_globals, modos_module_globals_table); + +const mp_obj_module_t modos_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&modos_module_globals, +}; diff --git a/python/port/mpconfigport.h b/python/port/mpconfigport.h index 53c3bb90a..20024c5b7 100644 --- a/python/port/mpconfigport.h +++ b/python/port/mpconfigport.h @@ -131,6 +131,7 @@ extern const struct _mp_obj_module_t modkandinsky_module; extern const struct _mp_obj_module_t modmatplotlib_module; extern const struct _mp_obj_module_t modpyplot_module; extern const struct _mp_obj_module_t modtime_module; +extern const struct _mp_obj_module_t modos_module; extern const struct _mp_obj_module_t modturtle_module; #define MICROPY_PORT_BUILTIN_MODULES \ @@ -139,5 +140,6 @@ extern const struct _mp_obj_module_t modturtle_module; { MP_ROM_QSTR(MP_QSTR_matplotlib), MP_ROM_PTR(&modmatplotlib_module) }, \ { MP_ROM_QSTR(MP_QSTR_matplotlib_dot_pyplot), MP_ROM_PTR(&modpyplot_module) }, \ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&modtime_module) }, \ + { MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&modos_module) }, \ { MP_ROM_QSTR(MP_QSTR_turtle), MP_ROM_PTR(&modturtle_module) }, \