2 # Verified on Ubuntu with dependencies...
3 # pip3 install watchdog
4 # sudo apt install rsync
7 from watchdog.observers import Observer
9 # the rsync command intended to selectively upload from the local repo to a feather m0 express
12 '--recursive --verbose --progress '
13 '--prune-empty-dirs --inplace --times --archive --whole-file '
14 # prefer unittest.py source code
15 '--exclude="/unittest.mpy" '
16 # don't upload upload https://www.youtube.com/watch?v=iEwW6D0sht0
17 '--exclude="upload_*_watch.py" '
20 # filter for python source files and micropython bytecode files
23 # exclude everything else
28 '/media/cefn/PYBFLASH '
34 """Synchronizes from git repo to Feather filesystem"""
37 subprocess.run(command, shell=True)
40 class ChangeEventHandler:
41 """handler for future filesystem events"""
42 def dispatch(self, event):
46 if __name__ == "__main__":
48 handler=ChangeEventHandler()
50 # set up filesystem monitoring
52 observer.schedule(handler, ".", recursive=True)
59 except KeyboardInterrupt:
61 # join daemon thread to shutdown interpreter