From 2425620013606172806af4c11ae1be928e8ac38f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 11 Sep 2023 20:21:39 +0100 Subject: [PATCH] Just "grep" what we're after Signed-off-by: Pedro Algarvio --- pkg/windows/build.ps1 | 7 ++----- pkg/windows/build_python.ps1 | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/windows/build.ps1 b/pkg/windows/build.ps1 index 961022be87b..72e29fc1d13 100644 --- a/pkg/windows/build.ps1 +++ b/pkg/windows/build.ps1 @@ -107,11 +107,8 @@ if ( [String]::IsNullOrEmpty($Version) ) { $yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml" $dict_versions = @{} -$yaml | ForEach-Object { - if ( $_.Name.Trim().EndsWith(":") ) { return } # This is likely a nested structure - $val1, $val2 = $_ -split ": " - $dict_versions[$val1] = $val2.Trim("""") -} +$dict_versions["python_version"]=($yaml | Select-String -Pattern "python_version: (.*)").matches.groups[1].Value.Trim("""") +$dict_versions["relenv_version"]=($yaml | Select-String -Pattern "relenv_version: (.*)").matches.groups[1].Value.Trim("""") if ( [String]::IsNullOrEmpty($PythonVersion) ) { $PythonVersion = $dict_versions["python_version"] diff --git a/pkg/windows/build_python.ps1 b/pkg/windows/build_python.ps1 index 60eb7edaddc..9257ae79456 100644 --- a/pkg/windows/build_python.ps1 +++ b/pkg/windows/build_python.ps1 @@ -77,11 +77,8 @@ function Write-Result($result, $ForegroundColor="Green") { $yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml" $dict_versions = @{} -$yaml | ForEach-Object { - if ( $_.Name.Trim().EndsWith(":") ) { return } # This is likely a nested structure - $val1, $val2 = $_ -split ": " - $dict_versions[$val1] = $val2.Trim("""") -} +$dict_versions["python_version"]=($yaml | Select-String -Pattern "python_version: (.*)").matches.groups[1].Value.Trim("""") +$dict_versions["relenv_version"]=($yaml | Select-String -Pattern "relenv_version: (.*)").matches.groups[1].Value.Trim("""") if ( [String]::IsNullOrEmpty($Version) ) { $Version = $dict_versions["python_version"]