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
omega-mv / uxl-run.ps1
| 1 | # One command for the UXL checks. Thin Windows entry. |
| 2 | # If a WSL distro is installed, hand off to ./uxl-run.sh there (same script, same flags). |
| 3 | # Otherwise run the Python checks here. omc stages are NOT_RUN, with the WSL2 hint. |
| 4 | # If execution policy blocks this file: |
| 5 | # powershell -ExecutionPolicy Bypass -File .\uxl-run.ps1 |
| 6 | $ErrorActionPreference = 'Continue' |
| 7 | Set-Location (Split-Path -Parent $MyInvocation.MyCommand.Path) |
| 8 | |
| 9 | function Get-WslDistro { |
| 10 | if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) { |
| 11 | return $null |
| 12 | } |
| 13 | $raw = & wsl.exe -l -q 2>$null |
| 14 | if ($LASTEXITCODE -ne 0 -or -not $raw) { |
| 15 | return $null |
| 16 | } |
| 17 | foreach ($item in @($raw)) { |
| 18 | $name = (($item -replace "`0", '')).Trim() |
| 19 | if ($name) { |
| 20 | return $name |
| 21 | } |
| 22 | } |
| 23 | return $null |
| 24 | } |
| 25 | |
| 26 | $distro = Get-WslDistro |
| 27 | if ($distro) { |
| 28 | $dir = (Get-Location).Path.Replace("'", "''") |
| 29 | $quoted = @() |
| 30 | foreach ($arg in $args) { |
| 31 | $quoted += "'" + ($arg -replace "'", "'\''") + "'" |
| 32 | } |
| 33 | $tail = $quoted -join ' ' |
| 34 | & wsl.exe -d $distro -- bash -lc "cd `$(wslpath -u '$dir') && ./uxl-run.sh $tail" |
| 35 | exit $LASTEXITCODE |
| 36 | } |
| 37 | |
| 38 | $ErrorActionPreference = 'Stop' |
| 39 | $python = $null |
| 40 | foreach ($name in @('py', 'python', 'python3')) { |
| 41 | $cmd = Get-Command $name -ErrorAction SilentlyContinue |
| 42 | if ($cmd) { $python = $cmd.Source; break } |
| 43 | } |
| 44 | if (-not $python) { |
| 45 | Write-Error 'Python 3.8+ not found (tried py, python, python3). On Windows, install WSL2 Ubuntu or Python, then rerun .\uxl-run.ps1' |
| 46 | exit 1 |
| 47 | } |
| 48 | & $python 'tools/uxl/run_all.py' @args |
| 49 | exit $LASTEXITCODE |