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 $Root = (Get-Item $Bin -Force).Parent.FullName
$Temp = "$Bin\tmp" $Temp = "$Bin\tmp"
$System32 = "{0}\System32" -f $Env:SystemRoot $System32 = "{0}\System32" -f $Env:SystemRoot
$SysWOW64 = "{0}\SysWOW64" -f $Env:SystemRoot
Push-Location "$WD" Push-Location "$WD"
$Host.UI.RawUI.BackgroundColor = "black" $Host.UI.RawUI.BackgroundColor = "black"
$Host.UI.RawUI.ForegroundColor = "white" $Host.UI.RawUI.ForegroundColor = "white"
@ -112,12 +113,25 @@ if ($MyInvocation.InvocationName -ne ".") {
$Url = FindDynamicUrl -SourcePage $DownloadPage -RegEx $RegEx $Url = FindDynamicUrl -SourcePage $DownloadPage -RegEx $RegEx
DownloadFile -Path $Path -Name $Name -Url $Url 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 ## ## Bail ##
# If errors were encountered during downloads # If errors were encountered during downloads
if ($DownloadErrors -gt 0) { if ($DownloadErrors -gt 0) {
Abort 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 ## ## Extract ##
# 7-Zip # 7-Zip
@ -192,6 +206,13 @@ if ($MyInvocation.InvocationName -ne ".") {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" 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\python*.zip"
Remove-Item "$Temp\*.whl" 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.BackgroundColor = "Black"
$Host.UI.RawUI.ForegroundColor = "White" $Host.UI.RawUI.ForegroundColor = "White"
$HostSystem32 = "{0}\System32" -f $Env:SystemRoot $HostSystem32 = "{0}\System32" -f $Env:SystemRoot
$HostSysWOW64 = "{0}\SysWOW64" -f $Env:SystemRoot
$DISM = "{0}\DISM.exe" -f $Env:DISMRoot $DISM = "{0}\DISM.exe" -f $Env:DISMRoot
#Enable TLS 1.2 #Enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@ -158,16 +159,16 @@ if ($MyInvocation.InvocationName -ne ".") {
@("produkey32.zip", "http://www.nirsoft.net/utils/produkey.zip"), @("produkey32.zip", "http://www.nirsoft.net/utils/produkey.zip"),
@("produkey64.zip", "http://www.nirsoft.net/utils/produkey-x64.zip"), @("produkey64.zip", "http://www.nirsoft.net/utils/produkey-x64.zip"),
# Python # Python
@("python32.zip", "https://www.python.org/ftp/python/3.6.0/python-3.6.0-embed-win32.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.6.0/python-3.6.0-embed-amd64.zip"), @("python64.zip", "https://www.python.org/ftp/python/3.7.0/python-3.7.0-embed-amd64.zip"),
# Python: psutil # Python: psutil
@( @(
"psutil64.whl", "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", "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 # Q-Dir
@("qdir32.zip", "https://www.softwareok.com/Download/Q-Dir_Portable.zip"), @("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"), @("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"),
# VirtIO drivers # VirtIO drivers
@("virtio-win.iso", "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso"), @("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 # wimlib-imagex
@("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip"), @("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") @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip")
@ -190,6 +194,13 @@ if ($MyInvocation.InvocationName -ne ".") {
if ($DownloadErrors -gt 0) { if ($DownloadErrors -gt 0) {
Abort 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 ## ## Extract ##
# 7-Zip # 7-Zip
@ -423,6 +434,12 @@ if ($MyInvocation.InvocationName -ne ".") {
catch { catch {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" 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) # Python (x32)
Write-Host "Extracting: Python (x32)" Write-Host "Extracting: Python (x32)"
@ -440,6 +457,12 @@ if ($MyInvocation.InvocationName -ne ".") {
catch { catch {
Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" 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 # Q-Dir
Write-Host "Extracting: Q-Dir" Write-Host "Extracting: Q-Dir"