File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,8 +159,17 @@ elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
159159 mpconfig_unix=" $codebasedir " /lvgl_micropython/lib/micropython/ports/unix/mpconfigport.h
160160 if ! grep -q " MICROPY_PY_WEBREPL" " $mpconfig_unix " ; then
161161 echo " Enabling MICROPY_PY_WEBREPL in $mpconfig_unix "
162- sed -i.backup ' /#include "mpconfigvariant.h"/a \
163- \n#ifndef MICROPY_PY_WEBREPL\n#define MICROPY_PY_WEBREPL (1)\n#endif\n' " $mpconfig_unix "
162+ python3 - " $mpconfig_unix " << 'PY '
163+ import pathlib
164+ import sys
165+
166+ path = pathlib.Path(sys.argv[1])
167+ text = path.read_text()
168+ needle = '#include "mpconfigvariant.h"'
169+ insert = "\n\n#ifndef MICROPY_PY_WEBREPL\n#define MICROPY_PY_WEBREPL (1)\n#endif\n"
170+ if needle in text and "MICROPY_PY_WEBREPL" not in text:
171+ path.write_text(text.replace(needle, needle + insert))
172+ PY
164173 else
165174 echo " MICROPY_PY_WEBREPL already configured in $mpconfig_unix "
166175 fi
You can’t perform that action at this time.
0 commit comments