32 lines
979 B
Python
32 lines
979 B
Python
"""Post-install check for the bundled catalogue and symbol library.
|
|||
|
|
|
||
|
|
Run during the image build so an image can never ship with an incomplete
|
||
|
|
library or a truncated catalogue. `cross_check` alone is not enough: it proves
|
||
|
|
only that the catalogue is a subset of the library, so a short catalogue passes
|
||
|
|
it and then rejects perfectly valid projects at runtime with "not stocked by
|
||
|
|
Visaton". `check_shape` is what gives this gate teeth.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import sys
|
||
|
|
|
||
|
|
from boxsim import catalog as catalog_mod
|
||
|
|
from boxsim import symbols as symbols_mod
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> int:
|
||
|
|
cat = catalog_mod.load()
|
||
|
|
catalog_mod.check_shape(cat)
|
||
|
|
lib = symbols_mod.load()
|
||
|
|
extras = symbols_mod.cross_check(cat, lib)
|
||
|
|
print(
|
||
|
|
f"bundled {len(cat)} catalogue parts across "
|
||
|
|
f"{len(cat.series_names)} series, {len(lib)} symbols; "
|
||
|
|
f"library-only symbols: {extras or 'none'}"
|
||
|
|
)
|
||
|
|
return 0
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
sys.exit(main())
|