qmk_firmware/lib
Sergey Vlasov 7e27d72cbc
Fix qmk find failure due to circular imports (#22523)
There was an import cycle in the Python modules:

  - `qmk.build_targets` imported `qmk.cli.generate.compilation_database`;
  - importing `qmk.cli.generate.compilation_database` requires
    initializing `qmk.cli` first;
  - the initialization of `qmk.cli` imported the modules for all CLI
    commands;
  - `qmk.cli.compile` imported `qmk.build_targets`.

This cycle did not matter in most cases, because `qmk.cli` was imported
first, and in that case importing `qmk.cli.generate.compilation_database`
did not trigger the initialization of `qmk.cli` again.  However, there was
one corner case when `qmk.bulld_targets` was getting imported first:

  - The `qmk find` command uses the `multiprocessing` module.
  - The `multiprocessing` module uses the `spawn` start method on macOS
    and Windows.
  - When the `spawn` method is used, the child processes initialize
    without any Python modules loaded, and the required modules are loaded
    on demand by the `pickle` module when receiving the serialized objects
    from the main process.

The result was that the `qmk find` command did not work properly on macOS
(and probably Windows too); it reported exceptions like this:

    ImportError: cannot import name 'KeyboardKeymapBuildTarget' from partially initialized module 'qmk.build_targets' (most likely due to a circular import)

Moving the offending `qmk.cli.generate.compilation_database` import into
the method which actually uses it fixes the problem.
2023-11-21 15:05:29 +00:00
..
arm_atsam/packs CTRL keyboard bootloader_jump support 2018-09-28 23:09:53 -04:00
chibios@11edb16109 Update ChibiOS to latest stable 21.11.x (#20470) 2023-04-19 16:05:06 +10:00
chibios-contrib@da78eb3759 [Core] Update ChibiOS-Contrib (#21553) 2023-07-17 19:55:31 +10:00
fnv Fix AVR compilation of FNV by using standard integer typenames. (#17716) 2022-07-19 05:30:01 +01:00
googletest@e2239ee604 Bump gtest (#13885) 2021-08-05 10:46:14 +10:00
lib8tion Spirals, Pinwheels, and Documentation....Oh My! RGB Matrix Effects (#5877) 2019-05-19 09:19:46 -07:00
lufa@549b97320d Update LUFA submodule (#18168) 2022-08-26 12:19:34 +10:00
lvgl@e19410f8f8 [Core] Quantum Painter - LVGL Integration (#18499) 2022-12-13 07:51:14 +11:00
pico-sdk@a3398d8d3a Update pico-sdk to 1.5.0 (#19829) 2023-02-13 15:51:51 +01:00
printf@c2e3b4e10d [Core] Update mpaland/printf to eyalroz/printf fork (#16163) 2022-07-07 09:27:50 +02:00
python Fix qmk find failure due to circular imports (#22523) 2023-11-21 15:05:29 +00:00
usbhost Revert lib/usbhost changes (#19165) 2022-11-27 02:05:04 +00:00
vusb@819dbc1e5d Update V-USB submodule (#17385) 2022-06-16 21:02:40 +10:00