sagas/mpy: Use main module name instead of __main__.#2367
sagas/mpy: Use main module name instead of __main__.#2367laurensvalk wants to merge 2 commits intomasterfrom
Conversation
This is separate from Python's __main__ mechanism, so we shouldn't be manually renaming things to __main__ here. This also makes file names show correctly on EV3. See pybricks/support#2364
|
Is there any version of the firmware that checks for the name |
|
Thanks. Hmm, because we do show the update warning, my brain was at this one:
Originally posted by @dlech in #2364 But that was about the intermediate versions, and we probably still do need the following:
Originally posted by @laurensvalk in #2364 But we don't have access to the currently active version in that module, so needs some more work. |
|
Should do the trick: const fwVersion = yield* select((s: RootState) => s.hub.deviceFirmwareVersion);If it is empty string (because not connected to a hub), then use the "new" way since we are just doing compile check and not downloading. |
|
Or if we want to be fancy, we could add a new state flag like |
Heh, I started that way but thought you'd call me out on that 😄
So that is indeed what I tried. I'm always a little puzzled doing this, as there seem to be so many placed to add a single boolean condition. |
I think it would be fine to do: const useLegacyMainModule = yield* select((s: RootState) => s.hub.useLegacyMainModule);In the mpy saga so that we don't have to add it as a parameter to the action. |
This is separate from Python's
__main__mechanism, so we shouldn't be manually renaming things to__main__here.This also makes file names show correctly on EV3.
See pybricks/support#2364