From 37902c1aca190c96615d61d39f1b2b1ee9fa1f9b Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Fri, 21 Jun 2019 11:53:19 +0300 Subject: First try downloading Python 2.X.Y --- download.ps1 | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'download.ps1') diff --git a/download.ps1 b/download.ps1 index ed23363..d90252b 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 { + msiexec /qn /i $target TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite ALLUSERS=1 + Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force +} -- cgit v1.2.3 From 0d4c1ef987ce39ec28182272efcd205eefba1d14 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Fri, 21 Jun 2019 12:03:15 +0300 Subject: Log to file for Python 2 --- download.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'download.ps1') diff --git a/download.ps1 b/download.ps1 index d90252b..e9a4f7b 100644 --- a/download.ps1 +++ b/download.ps1 @@ -34,6 +34,6 @@ if ($env:PYVERSION -like "3.*") { # Remove all __pycache__ directories Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse } else { - msiexec /qn /i $target TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite ALLUSERS=1 + msiexec /qn /i $target /L*V $logfile TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite ALLUSERS=1 Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force } -- cgit v1.2.3 From f95c1a668dbed1f8737bb7c2164a56813152d649 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sun, 23 Jun 2019 21:12:06 +0300 Subject: Remove ALLUSERS=1 property from Python 2 install command --- download.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'download.ps1') diff --git a/download.ps1 b/download.ps1 index e9a4f7b..78bb4a9 100644 --- a/download.ps1 +++ b/download.ps1 @@ -34,6 +34,6 @@ if ($env:PYVERSION -like "3.*") { # Remove all __pycache__ directories Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse } else { - msiexec /qn /i $target /L*V $logfile TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite ALLUSERS=1 + msiexec /qn /i $target /L*V $logfile TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force } -- cgit v1.2.3 From 5ccf25699d8f0beda0d8bb5bf19dbd08692ee893 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sun, 23 Jun 2019 21:26:03 +0300 Subject: Use Start-Process with -Wait argument to execute msiexec --- download.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'download.ps1') diff --git a/download.ps1 b/download.ps1 index 78bb4a9..df06a92 100644 --- a/download.ps1 +++ b/download.ps1 @@ -34,6 +34,6 @@ if ($env:PYVERSION -like "3.*") { # Remove all __pycache__ directories Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse } else { - msiexec /qn /i $target /L*V $logfile TARGETDIR=$targetdir ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools REMOVE=Extensions,Testsuite + 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 } -- cgit v1.2.3