fix: vendor wcf python deps for isolated profile
This commit is contained in:
@@ -6,6 +6,7 @@ $ExtractRoot = Join-Path $Root "wechat-3.9.12.51-extracted"
|
||||
$VersionRoot = Join-Path $ExtractRoot "[3.9.12.51]"
|
||||
$DataRoot = Join-Path $Root "data\profile"
|
||||
$WcfRoot = Join-Path $Root "wcf\v39.5.2"
|
||||
$PythonSite = Join-Path $WcfRoot "python-site"
|
||||
$StateRoot = Join-Path $Root "wcf-state"
|
||||
$DownloadRoot = Join-Path $Root "downloads"
|
||||
$PrepareResult = Join-Path $StateRoot "prepare-result.json"
|
||||
@@ -15,7 +16,7 @@ $PipIndex = "http://mirrors.aliyun.com/pypi/simple/"
|
||||
$ReleaseBase = "https://github.com/lich0821/WeChatFerry/releases/download/v39.5.2"
|
||||
$RegistryPath = "HKCU:\Software\Tencent\WeChat"
|
||||
|
||||
New-Item -ItemType Directory -Force $WechatRoot,$ExtractRoot,$VersionRoot,$DataRoot,$WcfRoot,$StateRoot,$DownloadRoot | Out-Null
|
||||
New-Item -ItemType Directory -Force $WechatRoot,$ExtractRoot,$VersionRoot,$DataRoot,$WcfRoot,$PythonSite,$StateRoot,$DownloadRoot | Out-Null
|
||||
$StartedAt = (Get-Date).ToUniversalTime().ToString("o")
|
||||
|
||||
function Write-PrepareProgress {
|
||||
@@ -124,7 +125,7 @@ function Install-Wcferry {
|
||||
$pipOut = Join-Path $StateRoot "prepare-pip.stdout.log"
|
||||
$pipErr = Join-Path $StateRoot "prepare-pip.stderr.log"
|
||||
Write-PrepareProgress "pip-install-start"
|
||||
& $Python -m pip install --trusted-host mirrors.aliyun.com --index-url $PipIndex --timeout 120 --retries 8 "wcferry==39.5.2.0" > $pipOut 2> $pipErr
|
||||
& $Python -m pip install --upgrade --target $PythonSite --trusted-host mirrors.aliyun.com --index-url $PipIndex --timeout 120 --retries 8 "wcferry==39.5.2.0" > $pipOut 2> $pipErr
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip install wcferry failed; see $pipErr" }
|
||||
Write-PrepareProgress "pip-install-done"
|
||||
|
||||
@@ -142,7 +143,13 @@ payload = {
|
||||
}
|
||||
print(json.dumps(payload, ensure_ascii=False))
|
||||
'@ | Set-Content -Encoding utf8 $probePy
|
||||
$pyProbe = (& $Python $probePy) | ConvertFrom-Json
|
||||
$oldPythonPath = $env:PYTHONPATH
|
||||
try {
|
||||
$env:PYTHONPATH = if ($oldPythonPath) { "$PythonSite;$oldPythonPath" } else { $PythonSite }
|
||||
$pyProbe = (& $Python $probePy) | ConvertFrom-Json
|
||||
} finally {
|
||||
$env:PYTHONPATH = $oldPythonPath
|
||||
}
|
||||
return [ordered]@{
|
||||
ok = [bool]$pyProbe.ok
|
||||
version = $pyProbe.wcferryVersion
|
||||
@@ -231,6 +238,7 @@ $summary = [ordered]@{
|
||||
requiredVersion = "3.9.12.51"
|
||||
profile = $profile
|
||||
wcfRoot = $WcfRoot
|
||||
pythonSite = $PythonSite
|
||||
stateRoot = $StateRoot
|
||||
python = $Python
|
||||
wcferryVersion = $wcferry.version
|
||||
|
||||
Reference in New Issue
Block a user