Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,4 @@ old/
src/plugins/*/*.json
src/plugins/*/*.db
.vscode/
src/history.db
history_show_fields.json
src/out.json
data/*
36 changes: 36 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@echo off
chcp 65001 >nul 2>&1

set OUT=dist\app
set DEST=%OUT%\metaminsweeper

echo [Clean] Removing old builds...
if exist "%OUT%\metaminsweeper" rmdir /s /q "%OUT%\metaminsweeper"
if exist "%OUT%\plugin_manager" rmdir /s /q "%OUT%\plugin_manager"

echo.
echo [1/3] metaminsweeper.exe
pyinstaller --noconfirm --name metaminsweeper --windowed --distpath %OUT% src\main.py

echo.
echo [2/3] plugin_manager.exe
pyinstaller --noconfirm --name plugin_manager --windowed --hidden-import code --hidden-import xmlrpc --hidden-import xmlrpc.server --hidden-import xmlrpc.client --hidden-import http.server --hidden-import socketserver --hidden-import email --hidden-import email.utils --distpath %OUT% src\plugin_manager\_run.py

echo.
echo [3/3] Copy resources to metaminsweeper\
copy /y "%OUT%\plugin_manager\plugin_manager.exe" "%DEST%\"
xcopy /e /y /i "%OUT%\plugin_manager\_internal" "%DEST%\_internal" >nul
xcopy /e /y /i "src\plugin_manager" "%DEST%\plugin_manager" >nul
xcopy /e /y /i "src\plugins" "%DEST%\plugins" >nul
xcopy /e /y /i "src\shared_types" "%DEST%\shared_types" >nul
if exist "%DEST%\plugin_manager\_run.py" del /f /q "%DEST%\plugin_manager\_run.py"

echo [4/4] Copy debugpy from venv to _internal\
set SP=.venv\Lib\site-packages
xcopy /e /y /i "%SP%\debugpy" "%DEST%\_internal\debugpy" >nul
xcopy /e /y /i "%SP%\msgspec" "%DEST%\_internal\msgspec" >nul 2>nul
xcopy /e /y /i "%SP%\setuptools" "%DEST%\_internal\setuptools" >nul 2>nul

echo.
echo Done! Both in: %OUT%\
pause
26 changes: 26 additions & 0 deletions hook-debugpy-pyinstaller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
PyInstaller runtime hook for debugpy compatibility.
在 import debugpy 之前修复路径问题,确保 _vendored 目录可被找到。
"""
import os
import sys

# PyInstaller 打包后 __file__ 指向临时目录或 zip 内,
# debugpy/_vendored/__init__.py 用 os.path.abspath(__file__) 定位资源会失败。
# 此 hook 在任何代码执行前将 debugpy 的真实解压路径注入 sys._MEIPASS 搜索逻辑。

def _fix_debugpy_paths():
# PyInstaller 运行时,已解压的文件在 sys._MEIPASS 下
meipass = getattr(sys, "_MEIPASS", None)
if not meipass:
return # 非打包环境,不需要处理

debugpy_dir = os.path.join(meipass, "debugpy")
vendored_dir = os.path.join(debugpy_dir, "_vendored")

if os.path.isdir(debugpy_dir):
# 确保 debugpy 在 sys.path 中靠前(PyInstaller 已处理,但保险起见)
if debugpy_dir not in sys.path:
sys.path.insert(0, debugpy_dir)

_fix_debugpy_paths()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ setuptools==80.9.0
msgspec>=0.20.0
zmq>=0.0.0
pywin32

loguru
7 changes: 7 additions & 0 deletions src/lib_zmq_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from lib_zmq_plugins.shared.base import BaseCommand, BaseEvent, CommandResponse, SyncCommand
from lib_zmq_plugins.log import LogHandler, NullHandler

__all__ = [
"BaseEvent", "BaseCommand", "CommandResponse", "SyncCommand",
"LogHandler", "NullHandler",
]
3 changes: 3 additions & 0 deletions src/lib_zmq_plugins/client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from lib_zmq_plugins.client.zmq_client import ZMQClient

__all__ = ["ZMQClient"]
Loading
Loading