111 lines
3.9 KiB
Python
Executable File
111 lines
3.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
EXPECTED_PROJECT_VERSION = "0.4.7"
|
|
EXPECTED_RUNTIME_VERSION = "0.4.7-production-audited-nav-name-conflict-omission"
|
|
EXPECTED_BUILDER = "cm95pbf-builder/0.4.6-spatial-candidate-query"
|
|
|
|
|
|
def fail(message: str) -> None:
|
|
print(f"FAIL: {message}")
|
|
raise SystemExit(2)
|
|
|
|
|
|
def require_fragment(path: Path, fragment: str) -> None:
|
|
text = path.read_text(encoding="utf-8")
|
|
if fragment not in text:
|
|
fail(f"{path} 缺少: {fragment}")
|
|
|
|
|
|
def main() -> None:
|
|
root = Path.cwd()
|
|
pyproject = root / "pyproject.toml"
|
|
init_py = root / "src/cm95pbf/__init__.py"
|
|
builder_py = root / "src/cm95pbf/builder.py"
|
|
release_py = root / "src/cm95pbf/release.py"
|
|
database_py = root / "src/cm93db/database.py"
|
|
|
|
required_paths = [
|
|
pyproject,
|
|
init_py,
|
|
builder_py,
|
|
release_py,
|
|
database_py,
|
|
root / "config/mappings/cm95_to_navsea_v1.yaml",
|
|
root / "config/mappings/cm95_gap_disposition_japan_dataset_1_v1.yaml",
|
|
root / "config/pbf/cm95_tile_policy_japan_full_detail_v1.yaml",
|
|
root / "config/style/style.navsea-delivery-full-semantic-unified-20260808-cm95-v1.json",
|
|
root / "config/sprite/semantic-sprite-20260808.json",
|
|
]
|
|
for path in required_paths:
|
|
if not path.exists():
|
|
fail(f"缺少文件: {path}")
|
|
|
|
require_fragment(pyproject, f'version = "{EXPECTED_PROJECT_VERSION}"')
|
|
require_fragment(init_py, EXPECTED_RUNTIME_VERSION)
|
|
require_fragment(init_py, EXPECTED_BUILDER)
|
|
|
|
for fragment in [
|
|
"mysql_compat_mode_for_connection",
|
|
"axis-order=long-lat",
|
|
"geom_from_wkb_sql",
|
|
"geom_from_text_sql",
|
|
"as_wkb_sql",
|
|
]:
|
|
require_fragment(database_py, fragment)
|
|
|
|
for fragment in [
|
|
'"POINT": ("chart_point_geometry", "spx_point_geom")',
|
|
'"LINE": ("chart_line_geometry", "spx_line_geom")',
|
|
'"AREA": ("chart_area_geometry", "spx_area_geom")',
|
|
"FORCE INDEX ({spatial_index})",
|
|
"STRAIGHT_JOIN chart_feature f ON f.id=g.feature_id",
|
|
]:
|
|
require_fragment(builder_py, fragment)
|
|
|
|
for fragment in [
|
|
"AMBIGUOUS_DIRECT_NAMES_OMIT_LABEL_FAIL_CLOSED",
|
|
"_collect_nav_name_conflict_expectations",
|
|
"_observe_nav_name_conflict_feature",
|
|
"_finalize_nav_name_conflict_audit",
|
|
"ambiguous_conflict_was_labeled",
|
|
'failures.append("nav_name_conflict_audit")',
|
|
'"nav_name_conflict_omissions"',
|
|
'"nav_name_conflict_unique_outputs"',
|
|
]:
|
|
require_fragment(release_py, fragment)
|
|
|
|
release_text = release_py.read_text(encoding="utf-8")
|
|
if 'failures.append("nav_name_conflicts")' in release_text:
|
|
fail("仍存在旧 nav_name_conflicts unconditional hard-fail")
|
|
|
|
try:
|
|
import cm95pbf
|
|
except Exception as exc:
|
|
fail(f"无法 import cm95pbf: {exc}")
|
|
|
|
if getattr(cm95pbf, "__version__", None) != EXPECTED_RUNTIME_VERSION:
|
|
fail(f"installed runtime={getattr(cm95pbf, '__version__', None)!r}")
|
|
if getattr(cm95pbf, "BUILDER_CONTRACT_VERSION", None) != EXPECTED_BUILDER:
|
|
fail(f"installed builder={getattr(cm95pbf, 'BUILDER_CONTRACT_VERSION', None)!r}")
|
|
|
|
print("CM95 Linux full rebuild preflight")
|
|
print("=" * 72)
|
|
print(f"Project version : {EXPECTED_PROJECT_VERSION} PASS")
|
|
print(f"Runtime version : {EXPECTED_RUNTIME_VERSION} PASS")
|
|
print(f"Builder contract : {EXPECTED_BUILDER} PASS")
|
|
print("Japan mapping/disposition : PASS")
|
|
print("Japan tile policy : PASS")
|
|
print("Style / sprite contract inputs : PASS")
|
|
print("Ambiguous-name finalizer gate : PASS")
|
|
print("Spatial-first builder invariant : PASS")
|
|
print("MySQL 5.7/8.0 spatial compat : PASS")
|
|
print("OVERALL : PASS")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|