-
Notifications
You must be signed in to change notification settings - Fork 2
/
acq400_remote_script.py
executable file
·43 lines (32 loc) · 1.08 KB
/
acq400_remote_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
""" remote scripting -f scriptfile UUT [UUT2]
"""
import sys
import acq400_hapi
import argparse
def handle_line(uuts, line):
if len(line) <= 1 or line.startswith('#'):
return
for uut in uuts:
uut.s0.sr(line)
def remote_script(args):
uuts = [acq400_hapi.Acq400(u) for u in args.uuts]
if args.trace:
for uut in uuts:
uut.s0.trace = args.trace
if args.script == '-':
for line in sys.stdin:
handle_line(uuts, line)
else:
with open(args.script) as f:
for line in f:
handle_line(uuts, line)
def run_main():
parser = argparse.ArgumentParser(description='acq400_remote_script')
parser.add_argument('-s','--script', default='-', help="script file [default stdin]")
parser.add_argument('-t','--trace', default=0, help="traces command execution")
parser.add_argument('uuts', nargs='+', help="uut[s]")
remote_script(parser.parse_args())
# execution starts here
if __name__ == '__main__':
run_main()