Files
ViewDesignEngine/python/test_native_wheels.ps1
T

33 lines
1.4 KiB
PowerShell

# Install and import-test the native cp311/cp314 wheels.
# Usage: powershell -ExecutionPolicy Bypass -File python/test_native_wheels.ps1
param(
[string]$WheelDir = "build/_dwgreview/native_wheels",
[string]$Python311 = "C:\Program Files\Python311\python.exe",
[string]$Python314 = "C:\Python314\python.exe"
)
$ErrorActionPreference = "Stop"
$root = (Resolve-Path ".").Path
$wheelDirAbs = (Resolve-Path $WheelDir).Path
$tests = @(
@{ Python = $Python311; Tag = "cp311-cp311-win_amd64" },
@{ Python = $Python314; Tag = "cp314-cp314-win_amd64" }
)
foreach ($test in $tests) {
$wheel = Join-Path $wheelDirAbs ("vde-1.0.87-" + $test.Tag + ".whl")
if (-not (Test-Path $wheel)) { throw "wheel not found: $wheel" }
$target = Join-Path $root ("build/_dwgreview/pyinstall_" + $test.Tag)
Remove-Item -Recurse -Force $target -ErrorAction SilentlyContinue
& $test.Python -m pip install --no-deps --target $target $wheel | Out-Null
if ($LASTEXITCODE -ne 0) { throw "pip failed: $wheel" }
$env:PYTHONPATH = $target
Push-Location (Join-Path $root "build/_dwgreview")
try {
& $test.Python -c "import vde; assert vde.native; assert vde.brep.make_box(2,3,4); print('WHEEL PASS', vde.__version__)"
if ($LASTEXITCODE -ne 0) { throw "import failed: $wheel" }
} finally {
Pop-Location
Remove-Item Env:\PYTHONPATH -ErrorAction SilentlyContinue
}
}
Write-Host "native wheel tests PASS"