Skip to content

Commit

Permalink
Rework replacement function for installer to use the same pattern lik…
Browse files Browse the repository at this point in the history
…e windows (#22)

* rework replacement function to use the same pattern like windows

* remove old replacement
  • Loading branch information
maxim-lobanov authored May 5, 2020
1 parent c0e7ef2 commit e6805b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions azure-pipelines/run-ci-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
pool:
name: Azure Pipelines
vmImage: 'ubuntu-latest'
timeoutInMinutes: 180

steps:
- checkout: self
Expand Down
9 changes: 8 additions & 1 deletion builders/nix-python-builder.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
6 changes: 3 additions & 3 deletions installers/nix-setup-template.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit e6805b9

Please sign in to comment.