Data, not hand-written code: tools/extract_registry.py reads widgets/common/registry.h and cross-checks it three ways - the on-disk widgets/components/ dirs, widgets/tools/sections.py, and the default_size() rule from gen_registry.py - failing on any drift. Re-derived counts (lightgui eb0b5fc): 547 widgets, 11 sections; families Gtk 102, Ind 250, Inst 66, Stock 37, T 90, X 2. The survey Stock 38 / Inst 67 counted the shared non-widget headers StockData.h / InstData.h; XGraph/XSpreadsheet form a sixth family X (2) the survey family table omitted. Includes the extraction harness: tools/common.py, extract_all.py, check.py (make check re-derives tables from the C++ sources and fails on drift), tools/README.md, and the top-level Makefile.
40 lines
1009 B
Python
40 lines
1009 B
Python
#!/usr/bin/env python3
|
|
"""Regenerate every data table from the C++ sources (data/*.json).
|
|
|
|
Runs the five extractors in dependency order:
|
|
registry -> palette, props, events, indicators
|
|
(palette cross-checks the registry; the others are independent but
|
|
run after it for a stable order).
|
|
|
|
Usage: python3 tools/extract_all.py (or: make regen)
|
|
"""
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
EXTRACTORS = [
|
|
"extract_registry.py",
|
|
"extract_palette.py",
|
|
"extract_props.py",
|
|
"extract_events.py",
|
|
"extract_indicators.py",
|
|
]
|
|
|
|
|
|
def main():
|
|
env = dict(os.environ)
|
|
for name in EXTRACTORS:
|
|
r = subprocess.run([sys.executable, os.path.join(HERE, name)],
|
|
env=env)
|
|
if r.returncode != 0:
|
|
print("extract_all: %s FAILED" % name, file=sys.stderr)
|
|
return r.returncode
|
|
print("extract_all: all data tables regenerated")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|