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 # should already be built-in to circuitpython
16 '--exclude="/digitalio" '
17 '--exclude="/microcontroller" '
18 # prefer unittest.mpy bytecode
19 '--exclude="/unittest.py" '
20 # should never be used by tests targeting feather m0
22 # don't upload upload https://www.youtube.com/watch?v=iEwW6D0sht0
23 '--exclude="upload_*_watch.py" '
26 # filter for python source files and micropython bytecode files
29 # exclude everything else
34 '/media/cefn/CIRCUITPY '
40 """Synchronizes from git repo to Feather filesystem"""
43 subprocess.run(command, shell=True)
46 class ChangeEventHandler:
47 """handler for future filesystem events"""
48 def dispatch(self, event):
52 if __name__ == "__main__":
54 handler=ChangeEventHandler()
56 # set up filesystem monitoring
58 observer.schedule(handler, ".", recursive=True)
65 except KeyboardInterrupt:
67 # join daemon thread to shutdown interpreter