From 1575a92dd8fc3ebee83005a98d088ec3659f63d4 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Apr 2026 17:09:06 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E9=87=8D=E6=9E=84=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6:=20=E7=A7=BB=E5=85=A5build/=E7=9B=AE?= =?UTF-8?q?=E5=BD=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 95c96a3346c035da73a3f79011b527cc66b9602e. --- README.md | 4 ++-- build_linux.sh | 33 +++++++++++++++++++++++++++++++++ build_windows.bat | 34 ++++++++++++++++++++++++++++++++++ docs/一键启动指南.md | 4 ++-- trulymem.spec | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 build_linux.sh create mode 100644 build_windows.bat create mode 100644 trulymem.spec diff --git a/README.md b/README.md index 2b301f4..e2c6eac 100644 --- a/README.md +++ b/README.md @@ -167,10 +167,10 @@ pytest tests/ ```bash # Windows -bash build/build_windows.bat +python build_windows.bat # Linux -bash build/build_linux.sh +bash build_linux.sh ``` --- diff --git a/build_linux.sh b/build_linux.sh new file mode 100644 index 0000000..b7104e3 --- /dev/null +++ b/build_linux.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Linux打包脚本 +# 需要在Linux系统上运行 + +echo "开始打包Linux版本..." + +# 检查Python和PyInstaller +if ! command -v python3 &> /dev/null; then + echo "错误: 未找到python3" + exit 1 +fi + +# 安装依赖 +echo "安装依赖..." +pip3 install -r requirements.txt + +# 打包Linux二进制文件 +echo "打包Linux二进制文件..." +python3 -m PyInstaller \ + --clean \ + --onefile \ + --name TrulyMEM \ + --console \ + --add-data "graph_memory_tui/styles/*.css:graph_memory_tui/styles" \ + --add-data "graph_memory_tui/web/templates/*.html:graph_memory_tui/web/templates" \ + --hidden-import textual \ + --hidden-import openai \ + --hidden-import flask \ + --hidden-import neo4j \ + graph_memory_tui/main.py + +echo "打包完成!" +echo "可执行文件位于: dist/TrulyMEM" diff --git a/build_windows.bat b/build_windows.bat new file mode 100644 index 0000000..7ecca5c --- /dev/null +++ b/build_windows.bat @@ -0,0 +1,34 @@ +@echo off +REM Windows打包脚本 + +echo 开始打包Windows版本... + +REM 检查Python +python --version >nul 2>&1 +if errorlevel 1 ( + echo 错误: 未找到python + exit /b 1 +) + +REM 安装依赖 +echo 安装依赖... +pip install -r requirements.txt + +REM 打包Windows exe文件 +echo 打包Windows exe文件... +python -m PyInstaller ^ + --clean ^ + --onefile ^ + --name TrulyMEM ^ + --console ^ + --add-data "graph_memory_tui/styles/*.css;graph_memory_tui/styles" ^ + --add-data "graph_memory_tui/web/templates/*.html;graph_memory_tui/web/templates" ^ + --hidden-import textual ^ + --hidden-import openai ^ + --hidden-import flask ^ + --hidden-import neo4j ^ + graph_memory_tui/main.py + +echo 打包完成! +echo 可执行文件位于: dist\TrulyMEM.exe +pause diff --git a/docs/一键启动指南.md b/docs/一键启动指南.md index f92b62d..6ec57d1 100644 --- a/docs/一键启动指南.md +++ b/docs/一键启动指南.md @@ -87,6 +87,6 @@ pip install -r requirements.txt pytest tests/ # 打包(需 PyInstaller) -bash build/build_windows.bat # Windows -bash build/build_linux.sh # Linux +python build_windows.bat # Windows +bash build_linux.sh # Linux ``` diff --git a/trulymem.spec b/trulymem.spec new file mode 100644 index 0000000..77aa43a --- /dev/null +++ b/trulymem.spec @@ -0,0 +1,38 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['trulymem_entry.py'], + pathex=[], + binaries=[], + datas=[('graph_memory_tui/styles/*.css', 'graph_memory_tui/styles'), ('graph_memory_tui/web/templates/*.html', 'graph_memory_tui/web/templates')], + hiddenimports=['textual', 'openai', 'flask', 'neo4j'], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='TrulyMEM', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +)