fix: bundle KneronPLUS SDK wheel for Windows device detection

The server's kneron_bridge.py requires the `kp` (KneronPLUS) module
to detect devices. Without it, HAS_KP=False and scan returns empty.

Changes:
- build-installer.ps1: copy KneronPLUS*.whl to payload/scripts/
- Makefile: same for macOS builds
- CI workflows: same for GitHub/Gitea Actions
- installer app.go: pip install the bundled wheel after requirements.txt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-03-09 21:10:03 +08:00
parent c8e628c6ca
commit f2596511e0
5 changed files with 34 additions and 0 deletions

View File

@ -115,6 +115,8 @@ jobs:
Copy-Item "$base\server\scripts\firmware\KL520\*.bin" "$base\installer\payload\scripts\firmware\KL520\"
Copy-Item "$base\server\scripts\firmware\KL720\*.bin" "$base\installer\payload\scripts\firmware\KL720\"
Copy-Item "local_service_win\third_party\Kneron_DFUT\bin\libusb-1.0.dll" "$base\installer\payload\scripts\"
$kpWheel = Get-ChildItem "local_service_win" -Filter "KneronPLUS*.whl" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($kpWheel) { Copy-Item $kpWheel.FullName "$base\installer\payload\scripts\" }
- name: Build Windows installer
run: |

View File

@ -115,6 +115,8 @@ jobs:
Copy-Item "$base\server\scripts\firmware\KL520\*.bin" "$base\installer\payload\scripts\firmware\KL520\"
Copy-Item "$base\server\scripts\firmware\KL720\*.bin" "$base\installer\payload\scripts\firmware\KL720\"
Copy-Item "local_service_win\third_party\Kneron_DFUT\bin\libusb-1.0.dll" "$base\installer\payload\scripts\"
$kpWheel = Get-ChildItem "local_service_win" -Filter "KneronPLUS*.whl" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($kpWheel) { Copy-Item $kpWheel.FullName "$base\installer\payload\scripts\" }
- name: Build Windows installer
run: |

View File

@ -130,6 +130,11 @@ installer-payload: build-server-tray ## Stage payload files for GUI installer
cp scripts/kneron_detect.py installer/payload/scripts/
cp server/scripts/firmware/KL520/*.bin installer/payload/scripts/firmware/KL520/
cp server/scripts/firmware/KL720/*.bin installer/payload/scripts/firmware/KL720/
@# Copy KneronPLUS wheel if available (for Windows installer)
@if ls ../local_service_win/KneronPLUS*.whl 1>/dev/null 2>&1; then \
cp ../local_service_win/KneronPLUS*.whl installer/payload/scripts/; \
echo " KneronPLUS wheel bundled."; \
fi
@echo "Payload staged in installer/payload/"
installer: installer-payload ## Build GUI installer app

View File

@ -494,6 +494,22 @@ func (inst *Installer) setupPythonVenv(installDir string) error {
return fmt.Errorf("pip install failed: %s — %w", string(out), err)
}
// Install KneronPLUS SDK wheel if bundled in payload
scriptsDir := filepath.Join(installDir, "scripts")
matches, _ := filepath.Glob(filepath.Join(scriptsDir, "KneronPLUS*.whl"))
if len(matches) > 0 {
inst.emitProgress(ProgressEvent{
Step: "python",
Message: "Installing Kneron SDK...",
Percent: 84,
})
cmd = exec.Command(pipPath, "install", matches[0])
if out, err := cmd.CombinedOutput(); err != nil {
// Non-fatal: device detection may still work via pyusb
_ = out
}
}
inst.emitProgress(ProgressEvent{
Step: "python",
Message: "Python environment ready.",

View File

@ -85,6 +85,15 @@ if (Test-Path $libusbSrc) {
Write-Host " libusb-1.0.dll not found, skipping." -ForegroundColor Yellow
}
# Copy KneronPLUS wheel if available
$kpWheel = Get-ChildItem (Join-Path $repoRoot "local_service_win") -Filter "KneronPLUS*.whl" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($kpWheel) {
Copy-Item $kpWheel.FullName installer\payload\scripts\
Write-Host " $($kpWheel.Name) bundled." -ForegroundColor Green
} else {
Write-Host " KneronPLUS wheel not found, skipping." -ForegroundColor Yellow
}
$fileCount = (Get-ChildItem -Recurse installer\payload -File).Count
Write-Host " Payload staged: $fileCount files." -ForegroundColor Green
Write-Host ""