From e6805b9e59773ec16de126ba658676b17b43e623 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 5 May 2020 09:44:58 +0300 Subject: [PATCH] Rework replacement function for installer to use the same pattern like windows (#22) * rework replacement function to use the same pattern like windows * remove old replacement --- azure-pipelines/run-ci-builds.yml | 1 + builders/nix-python-builder.psm1 | 9 ++++++++- installers/nix-setup-template.sh | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/run-ci-builds.yml b/azure-pipelines/run-ci-builds.yml index d7ae36b4..bf1ca43f 100644 --- a/azure-pipelines/run-ci-builds.yml +++ b/azure-pipelines/run-ci-builds.yml @@ -13,6 +13,7 @@ jobs: pool: name: Azure Pipelines vmImage: 'ubuntu-latest' + timeoutInMinutes: 180 steps: - checkout: self diff --git a/builders/nix-python-builder.psm1 b/builders/nix-python-builder.psm1 index ceb0cb38..f486697c 100644 --- a/builders/nix-python-builder.psm1 +++ b/builders/nix-python-builder.psm1 @@ -93,7 +93,14 @@ class NixPythonBuilder : PythonBuilder { $installationTemplateLocation = Join-Path -Path $this.InstallationTemplatesLocation -ChildPath $this.InstallationTemplateName $installationTemplateContent = Get-Content -Path $installationTemplateLocation -Raw - $installationTemplateContent = $installationTemplateContent -f $this.Version.Major, $this.Version.Minor, $this.Version.Build + + $variablesToReplace = @{ + "{{__VERSION_MAJOR__}}" = $this.Version.Major; + "{{__VERSION_MINOR__}}" = $this.Version.Minor; + "{{__VERSION_BUILD__}}" = $this.Version.Build; + } + $variablesToReplace.keys | ForEach-Object { $installationTemplateContent = $installationTemplateContent.Replace($_, $variablesToReplace[$_]) } + $installationTemplateContent | Out-File -FilePath $installationScriptLocation Write-Debug "Done; Installation script location: $installationScriptLocation)" diff --git a/installers/nix-setup-template.sh b/installers/nix-setup-template.sh index dd27788d..ea9a14b6 100644 --- a/installers/nix-setup-template.sh +++ b/installers/nix-setup-template.sh @@ -1,8 +1,8 @@ set -e -MAJOR_VERSION={0} -MINOR_VERSION={1} -BUILD_VERSION={2} +MAJOR_VERSION="{{__VERSION_MAJOR__}}" +MINOR_VERSION="{{__VERSION_MINOR__}}" +BUILD_VERSION="{{__VERSION_BUILD__}}" PYTHON_MAJOR=python$MAJOR_VERSION PYTHON_MAJOR_DOT_MINOR=python$MAJOR_VERSION.$MINOR_VERSION