55 lines
1.4 KiB
PowerShell
55 lines
1.4 KiB
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$repoRoot = Resolve-Path (Join-Path $scriptDir "..")
|
|
Set-Location $repoRoot
|
|
|
|
$pythonVersion = python -c "import sys; print('%d.%d.%d' % sys.version_info[:3])"
|
|
Write-Host "Using Python: $pythonVersion"
|
|
if ([version]$pythonVersion -lt [version]"3.10.0") {
|
|
Write-Warning "Project target is Python 3.10+. Switch to a 3.10+ environment before official release builds."
|
|
}
|
|
$spec = Join-Path $repoRoot "cmshopee.spec"
|
|
if (-not (Test-Path -LiteralPath $spec)) {
|
|
throw "Missing cmshopee.spec"
|
|
}
|
|
|
|
python -m PyInstaller --noconfirm --clean $spec
|
|
|
|
$distDir = Join-Path $repoRoot "dist\cmshopee"
|
|
$exePath = Join-Path $distDir "cmshopee.exe"
|
|
if (-not (Test-Path -LiteralPath $exePath)) {
|
|
throw "Build failed: $exePath not found"
|
|
}
|
|
|
|
$excluded = @(
|
|
"config.json",
|
|
"config\ai_models.json",
|
|
"cmshopee.db",
|
|
"cmshopee.db-wal",
|
|
"cmshopee.db-shm",
|
|
"db.sqlite",
|
|
"chrome_user_data_dir",
|
|
"images",
|
|
"logs",
|
|
"prompts",
|
|
"title_prompt.txt"
|
|
)
|
|
|
|
$found = @()
|
|
foreach ($relative in $excluded) {
|
|
$candidate = Join-Path $distDir $relative
|
|
if (Test-Path -LiteralPath $candidate) {
|
|
$found += $relative
|
|
}
|
|
}
|
|
|
|
if ($found.Count -gt 0) {
|
|
throw "Build output contains local user data: $($found -join ', ')"
|
|
}
|
|
|
|
Write-Host "Build complete: $exePath"
|
|
Write-Host "Do not copy local data into the release package."
|
|
|
|
|