From c7562fa8ef8f0d01709527238f4c53669e1e53ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 26 Feb 2018 09:18:55 +0200 Subject: Take proxy into use in python provisioning in windows Task-number: QTQAINFRA-1669 Change-Id: I2030f244da65e4fd0c3b0be54d941b065f9a180e Reviewed-by: Heikki Halmet --- coin/provisioning/common/windows/helpers.ps1 | 4 ++-- coin/provisioning/common/windows/python.ps1 | 11 ++++++----- coin/provisioning/common/windows/python3.ps1 | 11 ++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'coin/provisioning/common/windows') 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 -- cgit v1.2.3