Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cli/src/mpftp/firmware_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,14 @@ def modules(g):
need(g, "MODULES_DIR", "module_choices")
md = g["MODULES_DIR"]
names = set(g["module_choices"]())
# The modules pinned but maybe not fetched yet: DEPENDENCIES.lock's module
# lines through lock(), or modules.lock in a checkout from before it.
try:
names |= {row[0] for row in g["read_lock"]("modules.lock")}
except Exception:
if "lock" in g:
names |= {p.name for p in g["lock"]().values() if p.group == "modules"}
else:
names |= {row[0] for row in g["read_lock"]("modules.lock")}
except (Exception, SystemExit):
pass
recs = []
for n in sorted(names, key=lambda n: (n != "all", n)):
Expand Down
11 changes: 11 additions & 0 deletions cli/tests/test_firmware_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,17 @@ def test_modules_are_build_mps_with_the_lock_ones_not_yet_fetched(self) -> None:
self.assertIn("(opt-in)", text)
self.assertIn("(fetched on first build)", text)

def test_modules_pinned_in_dependencies_lock_are_listed_too(self) -> None:
script = self.bs / "build_mp.py"
old = 'def read_lock(name):\n return [("audiodsp", "url", "sha"), ("ulab", "url", "sha")]'
new = ('def lock():\n from types import SimpleNamespace as P\n'
' return {n: P(name=n, group=g) for n, g in (("micropython", "micropython"), '
'("ulab", "modules"), ("esp-idf", "toolchains"), ("omnipython-lvgl", "sources"))}')
self.assertIn(old, script.read_text())
script.write_text(script.read_text().replace(old, new))
info = run_engine(["modules", "--build-system", str(self.bs)])[0]
self.assertEqual(sorted(m["name"] for m in info["modules"]), ["all", "audiodsp", "castif", "tflite", "ulab"])

def test_circuitpython_lists_its_own_ports_and_our_boards(self) -> None:
cp = self.bs / "deps" / "circuitpython" / "ports"
cp.mkdir(parents=True)
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/build-firmware.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ build shows up, yours and upstream's alike.
`mpftp firmware modules` lists what `--modules` takes:

- A module's short name, from the checkout's `modules/` folder, marked **C**
or **Python**. A module pinned in `modules.lock` but not fetched yet is
or **Python**. A module the checkout pins but hasn't fetched yet is
listed too, marked "fetched on first build".
- `all`, which is every module except the opt-in ones (such as `tflite` and
`vision`, which are large). Name an opt-in module to build it.
Expand Down
Loading