Load the schema files, trying both cpp-module-schema.json and cpp-module-schema-latest.json
()
| 19 | import os |
| 20 | |
| 21 | def load_schemas(): |
| 22 | """Load the schema files, trying both cpp-module-schema.json and cpp-module-schema-latest.json""" |
| 23 | try: |
| 24 | with open('rust-module-schema.json', 'r') as f: |
| 25 | rust = json.load(f) |
| 26 | except FileNotFoundError: |
| 27 | print("Error: rust-module-schema.json not found") |
| 28 | print("Generate it with: spacetime describe module-test --json > rust-module-schema.json") |
| 29 | sys.exit(1) |
| 30 | except json.JSONDecodeError as e: |
| 31 | print(f"Error parsing rust-module-schema.json: {e}") |
| 32 | print("The file may be corrupted or incomplete. Try regenerating it.") |
| 33 | sys.exit(1) |
| 34 | |
| 35 | # Try to load C++ schema, checking both possible filenames |
| 36 | cpp = None |
| 37 | for filename in ['cpp-module-schema-latest.json', 'cpp-module-schema.json']: |
| 38 | if os.path.exists(filename): |
| 39 | with open(filename, 'r') as f: |
| 40 | cpp = json.load(f) |
| 41 | print(f"Loaded C++ schema from {filename}") |
| 42 | break |
| 43 | |
| 44 | if cpp is None: |
| 45 | print("Error: No C++ schema file found") |
| 46 | print("Generate it with: spacetime describe module-test-cpp --json > cpp-module-schema.json") |
| 47 | sys.exit(1) |
| 48 | |
| 49 | return rust, cpp |
| 50 | |
| 51 | def normalize_index(idx): |
| 52 | """Normalize index representation for comparison""" |