diff options
author | Liang Qi <liang.qi@qt.io> | 2018-06-08 13:19:30 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-08 13:19:30 +0200 |
commit | 7b7e0410fd612714e8cb6b5e821f68632a59ca46 (patch) | |
tree | 3159b090b189e4a8c96318220c55a35286905b84 /coin/provisioning/common/windows/python.ps1 | |
parent | 4ab6c1dace20df2a08e7939c3e32dc6a2ea0e2d3 (diff) | |
parent | eb1ca70defc74e6a81888940e2a35d70d3116d0b (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.11.1
Change-Id: I0bfda3a8816684275bd7f63372684cdf3e8b9ac3
Diffstat (limited to 'coin/provisioning/common/windows/python.ps1')
-rw-r--r-- | coin/provisioning/common/windows/python.ps1 | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/coin/provisioning/common/windows/python.ps1 b/coin/provisioning/common/windows/python.ps1 index 05811c58..e2855c75 100644 --- a/coin/provisioning/common/windows/python.ps1 +++ b/coin/provisioning/common/windows/python.ps1 @@ -30,13 +30,17 @@ ## $QT_END_LICENSE$ ## ############################################################################# -. "$PSScriptRoot\helpers.ps1" # This script installs Python $version. # Python is required for building Qt 5 from source. +param( + [Int32]$archVer=32, + [string]$targetDir="C:\Python27" +) +. "$PSScriptRoot\helpers.ps1" $version = "2.7.13" -if (Is64BitWinHost) { +if ( $archVer -eq 64 ) { $arch = ".amd64" $sha1 = "d9113142bae8829365c595735e1ad1f9f5e2894c" } else { @@ -51,17 +55,25 @@ Write-Host "Fetching from URL..." Download $externalUrl $internalUrl $package Verify-Checksum $package $sha1 Write-Host "Installing $package..." -Run-Executable "msiexec" "/passive /i $package ALLUSERS=1" +Run-Executable "msiexec" "/passive /i $package TARGETDIR=$targetDir ALLUSERS=1" # We need to change allowZip64 from 'False' to 'True' to be able to create ZIP files that use the ZIP64 extensions when the zipfile is larger than 2 GB Write-Host "Changing 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 +(Get-Content $targetDir\lib\zipfile.py) | ForEach-Object { $_ -replace "allowZip64=False", "allowZip64=True" } | Set-Content $targetDir\lib\zipfile.py Write-Host "Remove $package..." Remove-Item -Path $package -Add-Path "C:\Python27;C:\Python27\Scripts" +# When installing 32 bit python to 64 bit host, we want to keep only default python in path +# For cross-compilation we export some helper env variable +if (($archVer -eq 32) -And (Is64BitWinHost)) { + Set-EnvironmentVariable "PYTHON2_32_PATH" "$targetDir" + Set-EnvironmentVariable "PIP2_32_PATH" "$targetDir\Scripts" +} else { + Add-Path "$targetDir;$targetDir\Scripts" +} + -Run-Executable "C:\Python27\python.exe" "-m ensurepip" +Run-Executable "$targetDir\python.exe" "-m ensurepip" # Install python virtual env if (IsProxyEnabled) { @@ -69,6 +81,6 @@ if (IsProxyEnabled) { Write-Host "Using proxy ($proxy) with pip" $pip_args = "--proxy=$proxy" } -Run-Executable "C:\Python27\Scripts\pip.exe" "$pip_args install virtualenv" +Run-Executable "$targetDir\Scripts\pip.exe" "$pip_args install virtualenv" -Write-Output "Python = $version" >> ~/versions.txt +Write-Output "Python-$archVer = $version" >> ~/versions.txt |