Fix build script

This commit is contained in:
IRBorisov 2024-04-12 19:54:23 +03:00
parent 675798b442
commit cc5a13dc78

View File

@ -1,7 +1,7 @@
Set-Location $PSScriptRoot\.. Set-Location $PSScriptRoot\..
$packageName = 'cctext' $packageName = 'cctext'
$output = 'dist' $output = "${PSScriptRoot}\..\dist"
$python = '.\venv\Scripts\python.exe' $python = '.\venv\Scripts\python.exe'
if (-not (Test-Path -Path ${python} -PathType Leaf)) { if (-not (Test-Path -Path ${python} -PathType Leaf)) {
@ -9,19 +9,19 @@ if (-not (Test-Path -Path ${python} -PathType Leaf)) {
& ${python} -m pip install -r requirements-build.txt & ${python} -m pip install -r requirements-build.txt
} }
if (Test-Path -Path $output\$packageName) { if (Test-Path -Path ${output}) {
Remove-Item $output\$packageName -Recurse -Force Remove-Item ${output} -Recurse -Force
} }
& ${python} -m build --outdir=${output}\ & ${python} -m build --outdir="${output}\"
$wheel = Get-Childitem -Path ${output}\*.whl -Name $wheel = Get-Childitem -Path "${output}\*.whl" -Name
if (-not ${wheel}) { if (-not ${wheel}) {
Write-Error "No wheel generated for ${packageName}" Write-Error "No wheel generated for ${packageName}"
Exit 1 Exit 1
} }
& ${python} -m pip install -I ${output}\${wheel} & ${python} -m pip install -I "${output}\${wheel}"
& ${python} -m unittest & ${python} -m unittest
$exitcode = $LASTEXITCODE $exitcode = $LASTEXITCODE
& ${python} -m pip uninstall -y $packageName & ${python} -m pip uninstall -y ${packageName}
Exit $exitcode Exit ${exitcode}