Fetch the repository succeeded.
$exeName = "linghtApp.exe"
$mainScript = "main.py"
$buildDistDir = "build/exe"
$buildWorkDir = "build/tmp"
$specFile = "build/spec"
Write-Host "Checking for running EXE: $exeName..."
try {
$proc = Get-Process | Where-Object { $_.Name -eq [System.IO.Path]::GetFileNameWithoutExtension($exeName) }
if ($proc) {
Stop-Process -Name $proc.Name -Force
Start-Sleep -Seconds 1
Write-Host "Killed process $($proc.Name)"
} else {
Write-Host "No running process found."
}
} catch {
Write-Warning "Failed to stop process: $_"
}
Write-Host "Cleaning old build files..."
Remove-Item $buildDistDir -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $buildWorkDir -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $specFile -Force -ErrorAction SilentlyContinue
Write-Host "Building executable to $buildDir..."
python -m PyInstaller `
--onefile `
--name ([System.IO.Path]::GetFileNameWithoutExtension($exeName)) `
--distpath $buildDistDir `
--workpath $buildWorkDir `
--specpath $specFile `
$mainScript
Write-Host "Build completed! EXE located at $buildDir\$exeName"
pause
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。