aboutsummaryrefslogtreecommitdiff
path: root/download.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'download.ps1')
-rw-r--r--download.ps114
1 files changed, 14 insertions, 0 deletions
diff --git a/download.ps1 b/download.ps1
index df06a92..181edb2 100644
--- a/download.ps1
+++ b/download.ps1
@@ -22,6 +22,7 @@ Write-Output "Target: $target"
Write-Output "Target dir: $targetdir"
Write-Output "Log file: $logfile"
+Write-Output "Downloading $url"
$client = New-Object System.Net.WebClient
$client.DownloadFile($url, $target)
@@ -29,11 +30,24 @@ 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
+ Write-Output "Installing Python to $targetdir"
Start-Process -FilePath "$target" -ArgumentList "/quiet","/log","$logfile" -Wait
# Remove all __pycache__ directories
+ Write-Output "Removing __pycache__ directories"
Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse
} else {
+ Write-Output "Removing existing Python installation if there is one"
+ Start-Process -FilePath msiexec -ArgumentList "/qn","/x","$target" -Wait
+
+ Write-Output "Installing Python to $targetdir"
Start-Process -FilePath msiexec -ArgumentList "/qn","/i","$target","/L*V","$logfile","TARGETDIR=$targetdir","ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools","REMOVE=Extensions,Testsuite" -Wait
+
+ Write-Output "Removing .pyc files"
Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force
}
+
+if (Test-Path $targetdir\Scripts) {
+ Write-Output "Removing $targetdir\Scripts"
+ Remove-Item -Recurse -Force $targetdir\Scripts
+}