tools/mpremote: Add mpremote mip install to install packages.

This supports the same package sources as the new `mip` tool.
 - micropython-lib (by name)
 - http(s) & github packages with json description
 - directly downloading a .py/.mpy file

The version is specified with an optional `@version` on the end of the
package name. The target dir, index, and mpy/no-mpy can be set through
command line args.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2022-09-29 00:45:34 +10:00
parent 68d094358e
commit 12ca918eb2
6 changed files with 272 additions and 25 deletions

View File

@@ -476,6 +476,13 @@ class Pyboard:
t = str(self.eval("pyb.RTC().datetime()"), encoding="utf8")[1:-1].split(", ")
return int(t[4]) * 3600 + int(t[5]) * 60 + int(t[6])
def fs_exists(self, src):
try:
self.exec_("import uos\nuos.stat(%s)" % (("'%s'" % src) if src else ""))
return True
except PyboardError:
return False
def fs_ls(self, src):
cmd = (
"import uos\nfor f in uos.ilistdir(%s):\n"