aboutsummaryrefslogtreecommitdiff
path: root/download.ps1
diff options
context:
space:
mode:
authorOskari Timperi <oswjk@users.noreply.github.com>2019-08-19 23:19:52 +0300
committerGitHub <noreply@github.com>2019-08-19 23:19:52 +0300
commit9780b1fcb0a124d8ae01e424649fc8fddc50b1b8 (patch)
treef03e7877fc3ebe0bea31c193b43843252315576d /download.ps1
parent82d748d7a5f508c349817b407fc39e2d897d24df (diff)
downloadportablepython-9780b1fcb0a124d8ae01e424649fc8fddc50b1b8.tar.gz
portablepython-9780b1fcb0a124d8ae01e424649fc8fddc50b1b8.zip
* 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
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
+}