summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-09 21:34:01 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-09 21:34:01 (GMT)
commit321484b845e18471950585302737f9a1a9119c40 (patch)
tree67c0f64d5ee8515caa1b1855cbfb07a7ed3ac02c /tools
parent3ded49c5eff3edd9993c9ee88a96661a459b866a (diff)
tools: wasptool: Sneaky hack to avoid copying docstrings to the device
Diffstat (limited to 'tools')
-rwxr-xr-xtools/wasptool21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/wasptool b/tools/wasptool
index 099e802..72e88bc 100755
--- a/tools/wasptool
+++ b/tools/wasptool
@@ -27,16 +27,29 @@ def unsync(c):
c.sendline('wasp.run()')
def paste(c, f, verbose=False):
+ docstring = False
for ln in f.readlines():
ln = ln.rstrip()
- if not ln.lstrip().startswith('#'):
- c.sendline(ln)
- c.expect('=== ')
+
+ # This is a bit loose (definitely not PEP-257 compliant) but
+ # is enough for most code.
+ if ln.lstrip().startswith('"""'):
+ docstring = True
+ if docstring:
+ if ln.rstrip().endswith('"""'):
+ docstring = False
+ continue
+
+ if ln.lstrip().startswith('#'):
+ continue
+
+
+ c.sendline(ln)
+ c.expect('=== ')
if not verbose:
print('.', end='', flush=True)
-
def handle_eval(c, cmd):
verbose = bool(c.logfile)