mflmartin wrote: ↑
Tue Mar 02, 2021 8:46 pm
But this brings me to the next question: What would be the best way to install it in a new device automatically? (Without having to buiild micropython from sources). I am guessing, maybe, checking if it exists in the boot.py or in the main process and install it if it doesn't, or is there another recommended way?
I guess your new device also needs to have main.py (and potentially other files) copied anyway.
With previous projects I've had a script (a Makefile) with two targets: deploy and update. So deploy does a "first install" and copies all relevant files to the device (using pyboard.py). update just copies my code (i.e. it assumes things like base64.py and other libraries don't change).
You could also take a look at rshell which has a way to synchronise the host directory with the target (without copying every file every time).
(I guess what I'm saying is that you should have a directory on your PC, probably in source control, that mirrors the fileystem layout of the device, and the question is really a matter of how to synchronise that directory to the device).