From 22eaca9e36f1428586286c17a1402e70bf62a117 Mon Sep 17 00:00:00 2001 From: kushidou Date: Mon, 29 Jun 2026 08:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=A1=B9=E7=9B=AE=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + build.bat | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 34 ++++++++++++++++++++++++++++++++ requirements.txt | 3 +++ 4 files changed, 89 insertions(+) create mode 100644 build.bat create mode 100644 build.sh create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 6bdd590..0e1f865 100644 --- a/.gitignore +++ b/.gitignore @@ -221,3 +221,4 @@ __marimo__/ .claude *.deb +*.spec diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..dfb8fa8 --- /dev/null +++ b/build.bat @@ -0,0 +1,51 @@ +@echo off +chcp 65001 >nul +setlocal enabledelayedexpansion + +echo ============================== +echo deb查看器 打包脚本 +echo ============================== +echo. + +:: 检查 Python +python --version >nul 2>&1 +if errorlevel 1 ( + echo [错误] 未找到 Python,请先安装 Python 3.10+ + pause + exit /b 1 +) + +:: 安装/更新依赖 +echo [1/2] 安装依赖... +pip install -r requirements.txt -q +if errorlevel 1 ( + echo [错误] 依赖安装失败 + pause + exit /b 1 +) + +:: 打包 +echo [2/2] 正在打包为单个 exe... +echo. +pyinstaller ^ + --noconfirm ^ + --onefile ^ + --windowed ^ + --name "deb查看器" ^ + --clean ^ + deb_viewer.py + +if errorlevel 1 ( + echo. + echo [错误] 打包失败 + pause + exit /b 1 +) + +echo. +echo ============================== +echo 打包完成! +echo 输出: dist\deb查看器.exe +echo ============================== +echo. +pause diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..65fe673 --- /dev/null +++ b/build.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "==============================" +echo " deb查看器 打包脚本" +echo "==============================" +echo + +# 检查 Python +if ! command -v python3 &>/dev/null; then + echo "[错误] 未找到 python3,请先安装 Python 3.10+" + exit 1 +fi + +# 安装/更新依赖 +echo "[1/2] 安装依赖..." +pip3 install -r requirements.txt -q + +# 打包 +echo "[2/2] 正在打包为单个可执行文件..." +echo +pyinstaller \ + --noconfirm \ + --onefile \ + --windowed \ + --name "deb_viewer" \ + --clean \ + deb_viewer.py + +echo +echo "==============================" +echo " 打包完成!" +echo " 输出: dist/deb_viewer" +echo "==============================" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2670a4b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pyinstaller>=6.0 +windnd +zstandard