diff options
Diffstat (limited to 'download.ps1')
| -rw-r--r-- | download.ps1 | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/download.ps1 b/download.ps1 index ed23363..df06a92 100644 --- a/download.ps1 +++ b/download.ps1 @@ -1,7 +1,15 @@ -if ($env:PYARCH -eq "64") { - $filename = "python-${env:PYVERSION}-amd64.exe" +if ($env:PYVERSION -like "3.*") { + if ($env:PYARCH -eq "64") { + $filename = "python-${env:PYVERSION}-amd64.exe" + } else { + $filename = "python-${env:PYVERSION}.exe" + } } else { - $filename = "python-${env:PYVERSION}.exe" + if ($env:PYARCH -eq "64") { + $filename = "python-${env:PYVERSION}.amd64.msi" + } else { + $filename = "python-${env:PYVERSION}.msi" + } } $url = "https://www.python.org/ftp/python/${env:PYVERSION}/${filename}" @@ -17,10 +25,15 @@ Write-Output "Log file: $logfile" $client = New-Object System.Net.WebClient $client.DownloadFile($url, $target) -# Replace TARGET_DIR in unattend.xml.in with our target directory -((Get-Content -path unattend.xml.in -raw) -replace 'TARGET_DIR',$targetdir) | Set-Content -path unattend.xml +if ($env:PYVERSION -like "3.*") { + # Replace TARGET_DIR in unattend.xml.in with our target directory + ((Get-Content -path unattend.xml.in -raw) -replace 'TARGET_DIR',$targetdir) | Set-Content -path unattend.xml -Start-Process -FilePath "$target" -ArgumentList "/quiet","/log","$logfile" -Wait + Start-Process -FilePath "$target" -ArgumentList "/quiet","/log","$logfile" -Wait -# Remove all __pycache__ directories -Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse + # Remove all __pycache__ directories + Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse +} else { + Start-Process -FilePath msiexec -ArgumentList "/qn","/i","$target","/L*V","$logfile","TARGETDIR=$targetdir","ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools","REMOVE=Extensions,Testsuite" -Wait + Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force +} |
