CCText/scripts/Build.ps1

26 lines
672 B
PowerShell
Raw Normal View History

2024-04-10 20:54:12 +03:00
Set-Location $PSScriptRoot\..
$packageName = 'cctext'
2024-04-12 13:07:50 +03:00
$output = 'dist'
2024-04-10 20:54:12 +03:00
$python = '.\venv\Scripts\python.exe'
if (-not (Test-Path -Path $python -PathType Leaf)) {
& 'python' -m venv .\venv
& $python -m pip install -r requirements-build.txt
}
if (Test-Path -Path $output\$packageName) {
Remove-Item $output\$packageName -Recurse -Force
}
2024-04-12 13:07:50 +03:00
& $python -m build --outdir=$output\
$wheel = Get-Childitem -Path $output\*.whl -Name
2024-04-10 20:54:12 +03:00
if (-not $wheel) {
Write-Error "No wheel generated for $packageName"
Exit 1
}
2024-04-12 13:07:50 +03:00
& $python -m pip install -I $output\$wheel
2024-04-10 20:54:12 +03:00
& $python -m unittest
$exitcode = $LASTEXITCODE
& $python -m pip uninstall -y $packageName
Exit $exitcode