tools/mpremote: Fix mpremote mip install with multiple lib in sys.path.

This is a fix for an algorithmic error in mpremote mip, that throws an
error due to a '\n' used in the concatenation and split when there is more
than one lib path in `sys.path`.

Signed-off-by: Jos Verlinde <Jos.Verlinde@microsoft.com>
This commit is contained in:
Jos Verlinde 2024-06-23 14:17:47 +02:00 committed by Damien George
parent b4213c9c92
commit 3af1425be7

View File

@ -179,9 +179,9 @@ def do_mip(state, args):
if args.target is None:
state.transport.exec("import sys")
lib_paths = (
state.transport.eval("'\\n'.join(p for p in sys.path if p.endswith('/lib'))")
state.transport.eval("'|'.join(p for p in sys.path if p.endswith('/lib'))")
.decode()
.split("\n")
.split("|")
)
if lib_paths and lib_paths[0]:
args.target = lib_paths[0]