aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/helpers.ps1
diff options
context:
space:
mode:
authorHeikki Halmet <heikki.halmet@theqtcompany.com>2016-09-09 13:12:51 +0300
committerSimon Hausmann <simon.hausmann@qt.io>2016-09-30 08:31:18 +0000
commitc9d71e9eeb925ee4236acefeb88b14d80d04ba5e (patch)
treebe5e7325978d60c3b496fb7ec83ca1caa2e05677 /coin/provisioning/common/helpers.ps1
parent5ee2290c0c9d21230c46ba19f44e0a1f1ec772bf (diff)
Python to provisioning for Windows
Installs Python version 2.7.10. Python is required for building Qt 5 from source. More specifically qtdeclarative and qtwebkit require it. Change-Id: I63c8f3294a8a4799df5e52fbd41a36db8686950e Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Diffstat (limited to 'coin/provisioning/common/helpers.ps1')
-rw-r--r--coin/provisioning/common/helpers.ps129
1 files changed, 29 insertions, 0 deletions
diff --git a/coin/provisioning/common/helpers.ps1 b/coin/provisioning/common/helpers.ps1
index d7b957f3..0e684452 100644
--- a/coin/provisioning/common/helpers.ps1
+++ b/coin/provisioning/common/helpers.ps1
@@ -29,3 +29,32 @@ function Extract-Zip
$destinationFolder = $shell.Namespace($Destination)
$destinationFolder.CopyHere($zipfile.Items(), 16)
}
+
+function BadParam
+{
+ Param ([string]$Description)
+ throw("You must specify $Description")
+}
+
+function Download
+{
+ Param (
+ [string] $OfficialUrl = $(BadParam("the official download URL")),
+ [string] $CachedUrl = $(BadParam("the locally cached URL")),
+ [string] $Destination = $(BadParam("a download target location"))
+ )
+ try {
+ Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination
+ } catch {
+ Invoke-WebRequest -UseBasicParsing $OfficialUrl -OutFile $Destination
+ }
+}
+
+function Add-Path
+{
+ Param (
+ [string]$Path
+ )
+ echo "Adding $Path to Path"
+ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$Path", [EnvironmentVariableTarget]::Machine)
+}