Add PyArmor obfuscation packaging flow

This commit is contained in:
Your Name committed 2026-06-17 23:42:15 +08:00
1 parent 5166678590
commit 11de0f75c7
4 files changed
+292 -5

No files matched your search

+15 -5
View File
@@ -1,6 +1,7 @@
param(
[string]$Version = "",
[switch]$SkipInstall
[switch]$SkipInstall,
[switch]$Obfuscate
)
$ErrorActionPreference = "Stop"
@@ -15,6 +16,9 @@ if (-not $SkipInstall) {
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pyinstaller
if ($Obfuscate) {
python -m pip install pyarmor
}
}
$DistRoot = Join-Path $Root "dist\DouyinGuaji-$Version"
@@ -23,12 +27,18 @@ if (Test-Path $DistRoot) {
}
New-Item -ItemType Directory -Force $DistRoot | Out-Null
$BuildSourceRoot = $Root
if ($Obfuscate) {
$BuildSourceRoot = Join-Path $Root "build\obfuscated-src"
python -m tools.obfuscation_staging --source-root $Root --staging-root $BuildSourceRoot
}
$CommonArgs = @(
"--clean",
"--noconfirm",
"--distpath", $DistRoot,
"--workpath", (Join-Path $Root "build\pyinstaller"),
"--paths", $Root,
"--paths", $BuildSourceRoot,
"--add-data", "assets;assets",
"--add-data", "webui;webui",
"--add-data", "config\README.md;config",
@@ -36,9 +46,9 @@ $CommonArgs = @(
"--hidden-import", "ttkbootstrap"
)
python -m PyInstaller @CommonArgs --name DouyinGuajiGUI --windowed "gui\gui_app.py"
python -m PyInstaller @CommonArgs --name web_gui --console "gui\web_gui.py"
python -m PyInstaller @CommonArgs --name run_cli --console "bin\run_cli.py"
python -m PyInstaller @CommonArgs --name DouyinGuajiGUI --windowed (Join-Path $BuildSourceRoot "gui\gui_app.py")
python -m PyInstaller @CommonArgs --name web_gui --console (Join-Path $BuildSourceRoot "gui\web_gui.py")
python -m PyInstaller @CommonArgs --name run_cli --console (Join-Path $BuildSourceRoot "bin\run_cli.py")
foreach ($name in @("DouyinGuajiGUI", "web_gui", "run_cli")) {
$srcDir = Join-Path $DistRoot $name