No build metadata allowed in pypi versions

This commit is contained in:
Caelan Sayler
2025-06-15 15:56:58 +01:00
committed by Caelan
parent ffd5818496
commit 3c78aa251b

View File

@@ -1,17 +1,20 @@
param( # param(
[string]$version = $(nbgv get-version -v NuGetPackageVersion).Trim() # [string]$nuGetPackageVersion = $(nbgv get-version -v NuGetPackageVersion).Trim()
) # )
$semverVersion = $(nbgv get-version -v NuGetPackageVersion).Trim()
$fourpartVersion = $(nbgv get-version -v Version).Trim()
$originalLocation = Get-Location $originalLocation = Get-Location
# setting cargo workspace version # setting cargo workspace version
$scriptDir = "$PSScriptRoot/.." $scriptDir = "$PSScriptRoot/.."
$path = Join-Path $scriptDir "Cargo.toml" $path = Join-Path $scriptDir "Cargo.toml"
Write-Host "Setting version to $version" Write-Host "Setting version to $semverVersion"
(Get-Content $path) | ForEach-Object { (Get-Content $path) | ForEach-Object {
if ($_ -match '^version\s*=\s*".*"') { if ($_ -match '^version\s*=\s*".*"') {
$_ -replace '^version\s*=\s*".*"', "version = `"$version`"" $_ -replace '^version\s*=\s*".*"', "version = `"$semverVersion`""
} }
else { else {
$_ $_
@@ -20,15 +23,16 @@ Write-Host "Setting version to $version"
# setting nodejs version # setting nodejs version
Set-Location "$scriptDir/src/lib-nodejs" Set-Location "$scriptDir/src/lib-nodejs"
npm version $version --no-git-tag-version npm version $semverVersion --no-git-tag-version
# setting pyproject.toml version # setting pyproject.toml version
$pyprojectPath = [IO.Path]::Combine($scriptDir, 'src', 'lib-python', 'pyproject.toml') $pyprojectPath = [IO.Path]::Combine($scriptDir, 'src', 'lib-python', 'pyproject.toml')
$pythonVersion = $version $pythonVersion = $semverVersion
if ($pythonVersion -match '-g') { if ($pythonVersion -match '-g') {
$pythonVersion = $pythonVersion -replace '-g', '.dev+' $pythonVersion = $fourpartVersion -replace '^(\d+\.\d+\.\d+)\.(\d+)$', '${1}.dev${2}'
} }
Write-Host "Python version to $pythonVersion"
(Get-Content $pyprojectPath) | ForEach-Object { (Get-Content $pyprojectPath) | ForEach-Object {
if ($_ -match '^version\s*=\s*".*"') { if ($_ -match '^version\s*=\s*".*"') {