summaryrefslogtreecommitdiff
path: root/tools/pyboard.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-09-29 00:45:34 +1000
committerJim Mussared <jim.mussared@gmail.com>2022-10-01 22:44:24 +1000
commit12ca918eb2ac062f6e6df0772e528eef9d050cb7 (patch)
tree49be20380cce7d51d63a9dbf03b8628c622f1cb3 /tools/pyboard.py
parent68d094358ec71aa8cdec97e9e6fc3c6d46dedfbf (diff)
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>
Diffstat (limited to 'tools/pyboard.py')
-rwxr-xr-xtools/pyboard.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/pyboard.py b/tools/pyboard.py
index 60cc06508..043f4f06f 100755
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -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"