Fixed Python 3.7 dependencies

* This re-upgrades Python to 3.7 in WinPE
This commit is contained in:
2Shirt 2018-09-17 18:50:55 -06:00
parent e3aaa887c5
commit 79fc40e57a
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 48 additions and 4 deletions

View file

@ -11,6 +11,7 @@ $Bin = (Get-Item $WD).Parent.FullName
$Root = (Get-Item $Bin -Force).Parent.FullName
$Temp = "$Bin\tmp"
$System32 = "{0}\System32" -f $Env:SystemRoot
$SysWOW64 = "{0}\SysWOW64" -f $Env:SystemRoot
Push-Location "$WD"
$Host.UI.RawUI.BackgroundColor = "black"
$Host.UI.RawUI.ForegroundColor = "white"
@ -113,12 +114,25 @@ if ($MyInvocation.InvocationName -ne ".") {
DownloadFile -Path $Path -Name $Name -Url $Url
}
# Visual C++ Runtimes
$Url = "https://aka.ms/vs/15/release/vc_redist.x86.exe"
DownloadFile -Path $Path -Name "vcredist_x86.exe" -Url $Url
$Url = "https://aka.ms/vs/15/release/vc_redist.x64.exe"
DownloadFile -Path $Path -Name "vcredist_x64.exe" -Url $Url
## Bail ##
# If errors were encountered during downloads
if ($DownloadErrors -gt 0) {
Abort
}
## Install ##
# Visual C++ Runtimes
$ArgumentList = @("/install", "/passive", "/norestart")
Start-Process -FilePath "$Temp\vcredist_x86.exe" -ArgumentList $ArgumentList -Wait
Start-Process -FilePath "$Temp\vcredist_x64.exe" -ArgumentList $ArgumentList -Wait
Remove-Item "$Temp\vcredist*.exe"
## Extract ##
# 7-Zip
Write-Host "Extracting: 7-Zip"
@ -192,6 +206,13 @@ if ($MyInvocation.InvocationName -ne ".") {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
}
}
try {
Copy-Item -Path "$System32\vcruntime140.dll" -Destination "$Bin\Python\x64\vcruntime140.dll" -Force
Copy-Item -Path "$SysWOW64\vcruntime140.dll" -Destination "$Bin\Python\x32\vcruntime140.dll" -Force
}
catch {
Write-Host (" ERROR: Failed to copy Visual C++ Runtime DLLs." ) -ForegroundColor "Red"
}
Remove-Item "$Temp\python*.zip"
Remove-Item "$Temp\*.whl"

View file

@ -17,6 +17,7 @@ $Date = Get-Date -UFormat "%Y-%m-%d"
$Host.UI.RawUI.BackgroundColor = "Black"
$Host.UI.RawUI.ForegroundColor = "White"
$HostSystem32 = "{0}\System32" -f $Env:SystemRoot
$HostSysWOW64 = "{0}\SysWOW64" -f $Env:SystemRoot
$DISM = "{0}\DISM.exe" -f $Env:DISMRoot
#Enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@ -158,16 +159,16 @@ if ($MyInvocation.InvocationName -ne ".") {
@("produkey32.zip", "http://www.nirsoft.net/utils/produkey.zip"),
@("produkey64.zip", "http://www.nirsoft.net/utils/produkey-x64.zip"),
# Python
@("python32.zip", "https://www.python.org/ftp/python/3.6.0/python-3.6.0-embed-win32.zip"),
@("python64.zip", "https://www.python.org/ftp/python/3.6.0/python-3.6.0-embed-amd64.zip"),
@("python32.zip", "https://www.python.org/ftp/python/3.7.0/python-3.7.0-embed-win32.zip"),
@("python64.zip", "https://www.python.org/ftp/python/3.7.0/python-3.7.0-embed-amd64.zip"),
# Python: psutil
@(
"psutil64.whl",
(FindDynamicUrl "https://pypi.org/project/psutil/" "href=.*-cp36-cp36m-win_amd64.whl")
(FindDynamicUrl "https://pypi.org/project/psutil/" "href=.*-cp37-cp37m-win_amd64.whl")
),
@(
"psutil32.whl",
(FindDynamicUrl "https://pypi.org/project/psutil/" "href=.*-cp36-cp36m-win32.whl")
(FindDynamicUrl "https://pypi.org/project/psutil/" "href=.*-cp37-cp37m-win32.whl")
),
# Q-Dir
@("qdir32.zip", "https://www.softwareok.com/Download/Q-Dir_Portable.zip"),
@ -177,6 +178,9 @@ if ($MyInvocation.InvocationName -ne ".") {
@("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"),
# VirtIO drivers
@("virtio-win.iso", "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso"),
# Visual C++ Runtimes
@("vcredist_x86.exe", "https://aka.ms/vs/15/release/vc_redist.x86.exe"),
@("vcredist_x64.exe", "https://aka.ms/vs/15/release/vc_redist.x64.exe"),
# wimlib-imagex
@("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip"),
@("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip")
@ -191,6 +195,13 @@ if ($MyInvocation.InvocationName -ne ".") {
Abort
}
## Install ##
# Visual C++ Runtimes
Write-Host "Installing: Visual C++ Runtimes"
$ArgumentList = @("/install", "/passive", "/norestart")
Start-Process -FilePath "$Temp\vcredist_x86.exe" -ArgumentList $ArgumentList -Wait
Start-Process -FilePath "$Temp\vcredist_x64.exe" -ArgumentList $ArgumentList -Wait
## Extract ##
# 7-Zip
Write-Host "Extracting: 7-Zip"
@ -423,6 +434,12 @@ if ($MyInvocation.InvocationName -ne ".") {
catch {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
}
try {
Copy-Item -Path "$HostSystem32\vcruntime140.dll" -Destination "$Build\bin\amd64\python\vcruntime140.dll" -Force
}
catch {
Write-Host (" ERROR: Failed to copy Visual C++ Runtime DLL." ) -ForegroundColor "Red"
}
# Python (x32)
Write-Host "Extracting: Python (x32)"
@ -440,6 +457,12 @@ if ($MyInvocation.InvocationName -ne ".") {
catch {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red"
}
try {
Copy-Item -Path "$HostSysWOW64\vcruntime140.dll" -Destination "$Build\bin\x86\python\vcruntime140.dll" -Force
}
catch {
Write-Host (" ERROR: Failed to copy Visual C++ Runtime DLL." ) -ForegroundColor "Red"
}
# Q-Dir
Write-Host "Extracting: Q-Dir"