-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheasyEspCli.py
More file actions
34 lines (28 loc) · 910 Bytes
/
easyEspCli.py
File metadata and controls
34 lines (28 loc) · 910 Bytes
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
# -*- coding:utf-8 -*-
from watchdog.observers import Observer
from libs.handler import FileEventHandler
import fire
import time
import json
import sys
import os
class EzEsp(object):
def hotload(self, path, host):
host = host
observer = Observer()
event_handler = FileEventHandler(host)
observer.schedule(event_handler, path, True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
def deploy(self, com, srcpath):
for i in os.listdir(srcpath):
print(
'excuting:sudo ampy -p {0} put {1}/{2}'.format(com, srcpath, i))
os.system('sudo ampy -p {0} put {1}/{2}'.format(com, srcpath, i))
print('DONE.\nPLEASE REBOOT THE MACHINE TWICE,THEN YOU CAN USE HOTLOAD.')
if __name__ == "__main__":
fire.Fire(EzEsp)