aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Sarajärvi <tony.sarajarvi@qt.io>2018-02-26 09:18:55 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-02 19:01:40 +0000
commitc7562fa8ef8f0d01709527238f4c53669e1e53ff (patch)
tree80fcddba6f269b7e99d063f35514185d0502f0c4
parentf5af9f119b2c97469ab3621f0c2ee7498920f5c4 (diff)
Take proxy into use in python provisioning in windows
Task-number: QTQAINFRA-1669 Change-Id: I2030f244da65e4fd0c3b0be54d941b065f9a180e Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
-rw-r--r--coin/provisioning/common/windows/helpers.ps14
-rw-r--r--coin/provisioning/common/windows/python.ps111
-rw-r--r--coin/provisioning/common/windows/python3.ps111
3 files changed, 14 insertions, 12 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1
index a2535b25..8a4b452e 100644
--- a/coin/provisioning/common/windows/helpers.ps1
+++ b/coin/provisioning/common/windows/helpers.ps1
@@ -117,10 +117,10 @@ function Is64BitWinHost
return [environment]::Is64BitOperatingSystem
}
-function isProxyEnabled {
+function IsProxyEnabled {
return (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyEnable
}
-function getProxy {
+function Get-Proxy {
return (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer
}
diff --git a/coin/provisioning/common/windows/python.ps1 b/coin/provisioning/common/windows/python.ps1
index 28881d58..05811c58 100644
--- a/coin/provisioning/common/windows/python.ps1
+++ b/coin/provisioning/common/windows/python.ps1
@@ -64,10 +64,11 @@ Add-Path "C:\Python27;C:\Python27\Scripts"
Run-Executable "C:\Python27\python.exe" "-m ensurepip"
# Install python virtual env
-#if (isProxyEnabled) {
-# Write-Host "Using proxy with pip"
-# $pip_args = "--proxy=" + (getProxy)
-#}
-Run-Executable "C:\Python27\Scripts\pip.exe" "install virtualenv"
+if (IsProxyEnabled) {
+ $proxy = Get-Proxy
+ Write-Host "Using proxy ($proxy) with pip"
+ $pip_args = "--proxy=$proxy"
+}
+Run-Executable "C:\Python27\Scripts\pip.exe" "$pip_args install virtualenv"
Write-Output "Python = $version" >> ~/versions.txt
diff --git a/coin/provisioning/common/windows/python3.ps1 b/coin/provisioning/common/windows/python3.ps1
index cd5c8348..d5d5998a 100644
--- a/coin/provisioning/common/windows/python3.ps1
+++ b/coin/provisioning/common/windows/python3.ps1
@@ -65,11 +65,12 @@ Set-EnvironmentVariable "PYTHON3_PATH" "$install_path"
Set-EnvironmentVariable "PIP3_PATH" "$install_path\Scripts"
# Install python virtual env
-#if (isProxyEnabled) {
-# Write-Host "Using proxy with pip"
-# $pip_args = "--proxy=" + (getProxy)
-#}
-Run-Executable "$install_path\Scripts\pip3.exe" "install virtualenv"
+if (IsProxyEnabled) {
+ $proxy = Get-Proxy
+ Write-Host "Using proxy ($proxy) with pip"
+ $pip_args = "--proxy=$proxy"
+}
+Run-Executable "$install_path\Scripts\pip3.exe" "$pip_args install virtualenv"
Write-Output "Python3 = $version" >> ~/versions.txt