CCText/scripts/Build.ps1

27 lines
719 B
PowerShell
Raw Permalink Normal View History

2024-04-10 20:54:12 +03:00
Set-Location $PSScriptRoot\..
$packageName = 'cctext'
2024-04-12 19:54:23 +03:00
$output = "${PSScriptRoot}\..\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
}
2024-04-12 19:54:23 +03:00
if (Test-Path -Path ${output}) {
Remove-Item ${output} -Recurse -Force
2024-04-10 20:54:12 +03:00
}
2024-04-17 14:39:17 +03:00
& ${python} -m build --no-isolation --outdir="${output}\"
2024-04-12 19:54:23 +03:00
$wheel = Get-Childitem -Path "${output}\*.whl" -Name
2024-04-12 13:26:42 +03:00
if (-not ${wheel}) {
Write-Error "No wheel generated for ${packageName}"
2024-04-10 20:54:12 +03:00
Exit 1
}
2024-04-12 19:54:23 +03:00
& ${python} -m pip install -I "${output}\${wheel}"
2024-04-12 13:26:42 +03:00
& ${python} -m unittest
2024-04-10 20:54:12 +03:00
$exitcode = $LASTEXITCODE
2024-04-12 19:54:23 +03:00
& ${python} -m pip uninstall -y ${packageName}
Exit ${exitcode}