From 18c03a74dd133c84d0569648023c8e0ed486e61e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 5 Oct 2023 10:59:08 -0700 Subject: [PATCH] Fix a few tests * Re-enable a couple FATFS configurations we added. * Remove MICROPY_PY_IO_FILEIO. * Remove uasyncio from standard unix build. * Re-add our unicode printing improvements. --- extmod/vfs_fat_file.c | 2 -- lib/oofatfs/ffconf.h | 4 ++-- ports/atmel-samd/mpconfigport.h | 2 +- ports/broadcom/mpconfigport.h | 2 +- ports/unix/mpconfigport.h | 2 ++ ports/unix/variants/standard/manifest.py | 2 -- py/circuitpy_mpconfig.h | 5 ++--- py/objstrunicode.c | 9 ++++++--- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index a04b0a5971..72b712ab71 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -232,12 +232,10 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i mode |= FA_READ | FA_WRITE; plus_count++; break; - #if MICROPY_PY_IO_FILEIO case 'b': bt_count++; type = &mp_type_vfs_fat_fileio; break; - #endif case 't': bt_count++; type = &mp_type_vfs_fat_textio; diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h index fbb568f7c4..f22fbee932 100644 --- a/lib/oofatfs/ffconf.h +++ b/lib/oofatfs/ffconf.h @@ -72,8 +72,8 @@ #define FF_USE_MKFS 1 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ -#ifdef MICROPY_FF_MKFS_FAT32 -#define FF_MKFS_FAT32 MICROPY_FF_MKFS_FAT32 +#ifdef MICROPY_FATFS_MKFS_FAT32 +#define FF_MKFS_FAT32 MICROPY_FATFS_MKFS_FAT32 #else #define FF_MKFS_FAT32 0 #endif diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 19e95f1e96..71219ebcef 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -62,7 +62,7 @@ #define MICROPY_FATFS_EXFAT (0) // FAT32 mkfs takes about 500 bytes. -#define MICROPY_FF_MKFS_FAT32 (0) +#define MICROPY_FATFS_MKFS_FAT32 (0) // Only support simpler HID descriptors on SAMD21. #define CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR (1) diff --git a/ports/broadcom/mpconfigport.h b/ports/broadcom/mpconfigport.h index 6b73edaee8..453f126818 100644 --- a/ports/broadcom/mpconfigport.h +++ b/ports/broadcom/mpconfigport.h @@ -45,8 +45,8 @@ #define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (1920) #define CIRCUITPY_PROCESSOR_COUNT (4) -#define MICROPY_FF_MKFS_FAT32 (1) #define MICROPY_FATFS_EXFAT (1) +#define MICROPY_FATFS_MKFS_FAT32 (1) //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 7d3d1bcf7c..86ec15b822 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -154,6 +154,8 @@ typedef long mp_off_t; #define MICROPY_FATFS_RPATH (2) #define MICROPY_FATFS_MAX_SS (4096) #define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ +#define MICROPY_FATFS_MKFS_FAT32 (1) +#define MICROPY_FATFS_USE_LABEL (1) #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) diff --git a/ports/unix/variants/standard/manifest.py b/ports/unix/variants/standard/manifest.py index dd521258e1..08295fc678 100644 --- a/ports/unix/variants/standard/manifest.py +++ b/ports/unix/variants/standard/manifest.py @@ -1,3 +1 @@ include("$(PORT_DIR)/variants/manifest.py") - -include("$(MPY_DIR)/extmod/uasyncio") diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 82f8e2b93c..e066a1cabe 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -128,7 +128,6 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_PY_CMATH (0) #define MICROPY_PY_COLLECTIONS (CIRCUITPY_COLLECTIONS) #define MICROPY_PY_DESCRIPTORS (1) -#define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_GC (1) // Supplanted by shared-bindings/math #define MICROPY_PY_IO (CIRCUITPY_IO) @@ -264,8 +263,8 @@ typedef long mp_off_t; #define MICROPY_FATFS_EXFAT (CIRCUITPY_FULL_BUILD) #endif -#ifndef MICROPY_FF_MKFS_FAT32 -#define MICROPY_FF_MKFS_FAT32 (CIRCUITPY_FULL_BUILD) +#ifndef MICROPY_FATFS_MKFS_FAT32 +#define MICROPY_FATFS_MKFS_FAT32 (CIRCUITPY_FULL_BUILD) #endif // LONGINT_IMPL_xxx are defined in the Makefile. diff --git a/py/objstrunicode.c b/py/objstrunicode.c index 93383b3c19..505380c4b5 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -59,6 +59,7 @@ STATIC void uni_print_quoted(const mp_print_t *print, const byte *str_data, uint while (s < top) { unichar ch; ch = utf8_get_char(s); + const byte *start = s; s = utf8_next_char(s); if (ch == quote_char) { mp_printf(print, "\\%c", quote_char); @@ -72,12 +73,14 @@ STATIC void uni_print_quoted(const mp_print_t *print, const byte *str_data, uint mp_print_str(print, "\\r"); } else if (ch == '\t') { mp_print_str(print, "\\t"); - } else if (ch < 0x100) { + } else if (ch <= 0x1f || (0x7f <= ch && ch <= 0xa0) || ch == 0xad) { mp_printf(print, "\\x%02x", ch); - } else if (ch < 0x10000) { + } else if ((0x2000 <= ch && ch <= 0x200f) || ch == 0x2028 || ch == 0x2029) { mp_printf(print, "\\u%04x", ch); } else { - mp_printf(print, "\\U%08x", ch); + // Print the full character out. + int width = s - start; + mp_print_strn(print, (const char *)start, width, 0, ' ', width); } } mp_printf(print, "%c", quote_char);