CCText/scripts/Build.ps1

27 lines
697 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'
2024-04-12 13:26:42 +03:00
if (-not (Test-Path -Path ${python} -PathType Leaf)) {
2024-04-10 20:54:12 +03:00
& 'python' -m venv .\venv
2024-04-12 13:26:42 +03:00
& ${python} -m pip install -r requirements-build.txt
2024-04-10 20:54:12 +03:00
}
if (Test-Path -Path $output\$packageName) {
Remove-Item $output\$packageName -Recurse -Force
}
2024-04-12 13:26:42 +03:00
& ${python} -m build --outdir=${output}\
$wheel = Get-Childitem -Path ${output}\*.whl -Name
if (-not ${wheel}) {
Write-Error "No wheel generated for ${packageName}"
2024-04-10 20:54:12 +03:00
Exit 1
}
2024-04-12 13:26:42 +03:00
& ${python} -m pip install -I ${output}\${wheel}
& ${python} -m unittest
2024-04-10 20:54:12 +03:00
$exitcode = $LASTEXITCODE
2024-04-12 13:26:42 +03:00
& ${python} -m pip uninstall -y $packageName
2024-04-10 20:54:12 +03:00
Exit $exitcode