Only install platforms needed for current device
Rather than installing all the platforms from the global PLATFORMS variable, only install source (py) and the compiled (mpy) version that the currently connected device needs.
This allows some nice improvements:
- Only need to download at most, 2 versions of a bundle, not however many exist in
PLATFORMS. - A device doesn't NEED the compiled versions. So with this in mind, this change adds the behavior where if a compiled bundle can't be found, it falls back to installing the source version.
- Because of 2, a bundle maintainer doesn't have to provide compiled bundles to use their bundles with
circup. If only providing source bundles is sufficient,circupis now happy with that. It will check for and try to download a compiled bundle, but if it doesn't find it, it just falls back to the source bundle. - Also because of 2, if someone is using an older version of
circuitpythonthat is no longer getting compiled bundle builds, they can also still usecircup. In this case it again falls back to the source bundle (or pin to an older bundle version that does have the compiled bundle for the version ofcircuitpythonbeing used...circupno longer only supports specific platforms so if a platform bundle exists, it can use it).
What first prompted this was trying to find someone else's circuitpython bundle to test for one of the other PRs I did. I found sparkfun had made one but they hadn't updated it in a while and didn't have the 10.x-mpy platform bundle. Because of that, circup wouldn't even let me add their bundle because it failed to validate successfully. So from that I kinda started to think about it and wonder if there was a different way to go about handling platforms in circup. I figured it was kind of something I could try to play around with and see if I could put something together that made sense/was not too difficult to do. Ultimately, I'm happy with the end result.
But let me know what you think or if you have any questions about it!