tools/mpremote: Make mip install skip /rom*/lib directories.

If a ROMFS is mounted then "/rom/lib" is usually in `sys.path` before the
writable filesystem's "lib" entry.  The ROMFS directory cannot be installed
to, so skip it if found.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-03-11 14:52:15 +11:00
parent e4051a1ca6
commit 2db0c0225f

View File

@@ -175,7 +175,11 @@ def do_mip(state, args):
if args.target is None: if args.target is None:
state.transport.exec("import sys") state.transport.exec("import sys")
lib_paths = [p for p in state.transport.eval("sys.path") if p.endswith("/lib")] lib_paths = [
p
for p in state.transport.eval("sys.path")
if not p.startswith("/rom") and p.endswith("/lib")
]
if lib_paths and lib_paths[0]: if lib_paths and lib_paths[0]:
args.target = lib_paths[0] args.target = lib_paths[0]
else: else: