Fix adding to path lines for Windows provisioning scripts
authorJoni Jäntti <joni.jantti@qt.io>
Fri, 25 Aug 2017 06:02:36 +0000 (09:02 +0300)
committerSimon Hausmann <simon.hausmann@qt.io>
Wed, 30 Aug 2017 17:16:56 +0000 (17:16 +0000)
Currently the path addition command will forget the previous addition
when adding a new string. This hasn't been found out because python
was the only script using this command. Now we also need to set the
path for ruby, so the python string is left out.

Change-Id: I39721d78111550189e52a9f095030033f9660c0a
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Reviewed-by: Joni Jäntti <joni.jantti@qt.io>
coin/provisioning/common/install-ruby.ps1
coin/provisioning/common/python.ps1

index 332a3a8..be0bc3e 100644 (file)
@@ -48,4 +48,7 @@ cmd /c "$rubyPackage /silent"
 echo "Cleaning $rubyPackage.."
 Remove-Item -Recurse -Force "$rubyPackage"
 
+$oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
+[Environment]::SetEnvironmentVariable("Path", $oldPath + ";C:\Ruby22-x64\bin", [EnvironmentVariableTarget]::Machine)
+
 echo "Ruby = $version" >> ~\versions.txt
index 6c88689..2911445 100644 (file)
@@ -62,7 +62,9 @@ echo "Chancing allowZip64 value to 'True'..."
 (Get-Content C:\Python27\lib\zipfile.py) | ForEach-Object { $_ -replace "allowZip64=False", "allowZip64=True" } | Set-Content C:\Python27\lib\zipfile.py
 echo "Remove $package..."
 del $package
-[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Python27;C:\Python27\Scripts", [EnvironmentVariableTarget]::Machine)
+
+$oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
+[Environment]::SetEnvironmentVariable("Path", $oldPath + ";C:\Python27;C:\Python27\Scripts", [EnvironmentVariableTarget]::Machine)
 
 C:\Python27\python.exe -m ensurepip
 # Install python virtual env