From 9780b1fcb0a124d8ae01e424649fc8fddc50b1b8 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Mon, 19 Aug 2019 23:19:52 +0300 Subject: Fixes * Remove Scripts directory The Scripts directory contains executables that won't work on user system. The user needs to run ensurepip to make recreate the scripts. * Update README.md * Check if Scripts directory exists * Add logging to download.ps1 * Add /fa argument to msiexec command line Try to force installation even if there is a previous installation * Uninstall previous 2.x python --- download.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'download.ps1') 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 +} -- cgit v1.2.3