Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/adapters/build-retarget.py # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / adapters / build-retarget.py` 31 lines ยท 2626 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Host build orchestration only; all retarget computation is seeded Omega (translation-compose-v2 section 2).""" 3 from pathlib import Path 4 import hashlib,json,os,struct,subprocess,tempfile 5 ROOT=Path(__file__).resolve().parents[2] 6 build=ROOT/'build/L833' 7 for p in [ROOT/'build',build]: 8 if p.is_symlink():raise SystemExit('RETARGET_UNSAFE_BUILD_PATH') 9 build.mkdir(parents=True,exist_ok=True) 10 # The translation-v1 section-1 native realization compiler; it has argv (argcnt/argread) for `retarget M`. 11 expected='`734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`' 12 if not os.environ.get('OMEGA_NATIVE_OMC'):raise SystemExit('RETARGET_COMPILER_UNSET: set OMEGA_NATIVE_OMC to the pinned omc') 13 compiler=Path(os.environ['OMEGA_NATIVE_OMC']) 14 assert compiler.is_file() and hashlib.sha256(compiler.read_bytes()).hexdigest()==expected,'RETARGET_COMPILER_PIN_MISMATCH' 15 # Unchanged vendor SHA256 and the unchanged #621 v2 codec (its `decode` is the full source-aware v1/v2 check). 16 parts=[ROOT/'src/source-aware/vendor/sha256.om',ROOT/'src/source-aware/core-v2.om',ROOT/'src/adapters/upper-retarget.om'] 17 for p in parts: 18 if not p.is_file():raise SystemExit('RETARGET_MISSING_SOURCE: '+p.relative_to(ROOT).as_posix()) 19 subprocess.run(['sha256sum','-c','tools/source-aware/imports.sha256'],cwd=ROOT,check=True,stdout=subprocess.PIPE) 20 program=b'\n'.join(p.read_bytes() for p in parts)+b'\n' 21 result=subprocess.run([str(compiler)],input=program,capture_output=True,timeout=60) 22 if result.returncode:raise SystemExit('RETARGET_COMPILE_FAILED: '+result.stderr.decode(errors='replace')) 23 binary=result.stdout 24 assert len(binary)>64 and binary[:4]==b'\x7fELF' and struct.unpack_from('