Skip to content

Commit 6c72b24

Browse files
committed
browser URL policy: map the audiocomponents packages to their wheel names
MIP serves audioinstruments and audioeffects; the wheels on the index are pydevices-audioinstruments and pydevices-audioeffects. A first-party name missing from the table passed through unchanged, so the Pyodide host asked micropip for a project that does not exist -- what drum_machine hit. The new test walks every first-party dep name and fails on any that does not resolve to a wheel name; dropping the audioinstruments row makes it fail, so it guards the next package too.
1 parent 20ea16a commit 6c72b24

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_wasm_cli.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ def test_direct_builtins_are_not_reinstalled(self):
4343
resolve_dependencies(["palettes", "custom"], "wasm"), ["custom"]
4444
)
4545

46+
def test_every_first_party_dep_is_prefixed_for_pyodide(self):
47+
# MIP serves `audioinstruments`; the wheel on the index is
48+
# `pydevices-audioinstruments`. A first-party name missing from
49+
# _WHEEL_REWRITE passes through unchanged and micropip then looks for
50+
# a project that does not exist -- the failure drum_machine hit. Any
51+
# new first-party package belongs in both this list and the table.
52+
first_party = [
53+
"audioeffects",
54+
"audioif",
55+
"audioinstruments",
56+
"lvgl",
57+
"palettes",
58+
"pdwidgets",
59+
"pygraphics",
60+
]
61+
for name in first_party:
62+
with self.subTest(dep=name):
63+
resolved = resolve_dependencies([name], "pyodide")
64+
self.assertTrue(resolved, f"{name} resolved to nothing")
65+
self.assertTrue(
66+
resolved[0].startswith("pydevices-"),
67+
f"{name} -> {resolved[0]}, which is not a wheel name",
68+
)
69+
4670
def test_find_script_prefers_cwd_over_workspace_examples(self):
4771
# `wasm.py -m foo` should behave like real `micropython -m foo`,
4872
# where cwd (the empty sys.path entry) is searched before installed

tools/_browser_url.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
}
3636
_WHEEL_REWRITE = {
3737
"appdev": "pydevices",
38+
"audioeffects": "pydevices-audioeffects",
3839
"audioif": "pydevices-audioif",
40+
"audioinstruments": "pydevices-audioinstruments",
3941
"display-driver": "pydevices-lvgl",
4042
"displaydev": "pydevices",
4143
"lvgl": "pydevices-lvgl",

0 commit comments

Comments
 (0)