-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
70 lines (60 loc) · 2.63 KB
/
Copy pathbuild.ps1
File metadata and controls
70 lines (60 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Personal Profile MCP 打包脚本 (PowerShell)
Write-Host "========================================" -ForegroundColor Green
Write-Host "Personal Profile MCP 打包脚本" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "检查 PyInstaller 是否已安装..." -ForegroundColor Yellow
try {
$null = pip show pyinstaller 2>$null
if ($LASTEXITCODE -ne 0) {
Write-Host "PyInstaller 未安装,正在安装..." -ForegroundColor Yellow
pip install pyinstaller
if ($LASTEXITCODE -ne 0) {
Write-Host "PyInstaller 安装失败!" -ForegroundColor Red
Read-Host "按任意键退出"
exit 1
}
} else {
Write-Host "PyInstaller 已安装" -ForegroundColor Green
}
} catch {
Write-Host "检查 PyInstaller 时出错: $_" -ForegroundColor Red
Read-Host "按任意键退出"
exit 1
}
Write-Host ""
Write-Host "清理之前的构建文件..." -ForegroundColor Yellow
if (Test-Path "dist") { Remove-Item -Recurse -Force "dist" }
if (Test-Path "build") { Remove-Item -Recurse -Force "build" }
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "开始打包 main.py (UserBank_Stdio_Core.exe)" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
pyinstaller build_main.spec --clean --noconfirm
if ($LASTEXITCODE -ne 0) {
Write-Host "main.py 打包失败!" -ForegroundColor Red
Read-Host "按任意键退出"
exit 1
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "开始打包 main_sse.py (UserBank_SSE_Core.exe)" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
pyinstaller build_main_sse.spec --clean --noconfirm
if ($LASTEXITCODE -ne 0) {
Write-Host "main_sse.py 打包失败!" -ForegroundColor Red
Read-Host "按任意键退出"
exit 1
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "打包完成!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "生成的文件位置:" -ForegroundColor Cyan
Write-Host "- UserBank_Stdio_Core.exe: dist\UserBank_Stdio_Core.exe" -ForegroundColor White
Write-Host "- UserBank_SSE_Core.exe: dist\UserBank_SSE_Core.exe" -ForegroundColor White
Write-Host ""
Write-Host "您可以将这些 exe 文件复制到任何 Windows 机器上运行。" -ForegroundColor Green
Write-Host ""
Read-Host "按任意键退出"