tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

current_io_names.py (1737B)


      1 #!/usr/bin/env python3
      2 """Check current implementation names, excluding authenticated historical data.
      3 
      4 Wire tags, schemas and version dispatch have separate versioned contracts.
      5 """
      6 from pathlib import Path
      7 import re
      8 
      9 ROOT = Path(__file__).resolve().parent.parent
     10 OBSOLETE = re.compile(r'IOV2|ioV2|\bio_v2\b|io-v2|StreamingV2|streaming-v2|runIOV2|scopeV2|spawnV2|V2Host|mkRegistryV2')
     11 
     12 
     13 def main():
     14     failures = []
     15     for directory in ['src', 'lib', 'test', 'demos', 'tricu-apps', 'ext']:
     16         for path in (ROOT / directory).rglob('*'):
     17             relative = path.relative_to(ROOT)
     18             if not path.is_file() or 'fixtures' in relative.parts or '__pycache__' in relative.parts:
     19                 continue
     20             if OBSOLETE.search(str(relative)):
     21                 failures.append(str(relative))
     22     production = [*(ROOT/'src').rglob('*.hs'), *(ROOT/'lib').rglob('*.tri'),
     23                   *(ROOT/'ext/demo-site/src').rglob('*.ts'),
     24                   *(ROOT/'ext/haskell-wasm').glob('*.hs'),
     25                   *(ROOT/'ext/haskell-wasm').glob('*.mjs'),
     26                   ROOT/'tricu.workspace', ROOT/'bootstrap/compiler-source-map.v1', ROOT/'flake.nix']
     27     production += [p for parent in ['demos','test'] for p in (ROOT/parent).rglob('tricu.workspace') if 'fixtures' not in p.parts]
     28     for path in production:
     29         for number, line in enumerate(path.read_text().splitlines(), 1):
     30             if OBSOLETE.search(line):
     31                 failures.append(f'{path.relative_to(ROOT)}:{number}')
     32     if failures:
     33         raise SystemExit('Obsolete current IO names: ' + ', '.join(failures))
     34     print('Current IO implementation names are canonical; wire/provenance versions retained')
     35 
     36 
     37 if __name__ == '__main__':
     38     main()