Merge pull request #7364 from jepler/fix-unix-standard-build

fix ports/unix builds besides coverage
This commit is contained in:
Scott Shawcroft 2022-12-20 06:54:52 -08:00 committed by GitHub
commit e9f032f468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,10 @@
#endif
#endif
#if defined(MICROPY_UNIX_COVERAGE)
mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
#endif
STATIC mp_obj_t mod_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
@ -193,12 +197,13 @@ STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system);
mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) {
#if defined(MICROPY_UNIX_COVERAGE)
mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none);
if (result != mp_const_none) {
return result;
}
#endif
const char *s = getenv(mp_obj_str_get_str(var_in));
if (s == NULL) {
return mp_const_none;