feat: SSHClient v1.0.0 - PyQt5 + paramiko 跨平台 SSH 客户端
功能: - 多主机管理 (增删改查, 密码/私钥双认证, 导入导出) - 远程终端 (命令执行 + 常用命令快捷栏 + 超时控制) - SFTP 文件浏览 (上传/下载带进度, 新建/删除/重命名) - 实时监控 (CPU/内存/磁盘/网络, 1-10秒可调刷新) - AI Agent (OpenAI 兼容 API, 5 工具自动调用: 命令/指标/列文件/读文件/上传) 技术栈: PyQt5 + paramiko + psutil + requests + PyInstaller 打包: build_windows.bat / build.sh 一键产出 ~57MB 单文件 exe 测试: core 6/6 + UI 3/3 + E2E 6/6 全部通过
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
"""
|
||||
跨平台开发打包脚本(开发机/测试用)
|
||||
Linux/Mac: ./build.sh
|
||||
Windows: build_windows.bat
|
||||
"""
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).parent
|
||||
|
||||
def main():
|
||||
os.chdir(ROOT)
|
||||
print("=" * 50)
|
||||
print(f" SSHClient 打包脚本 ({platform.system()})")
|
||||
print("=" * 50)
|
||||
|
||||
venv = ROOT / "venv"
|
||||
if not venv.exists():
|
||||
print("[1/4] 创建虚拟环境...")
|
||||
subprocess.check_call([sys.executable, "-m", "venv", "venv"])
|
||||
if platform.system() == "Windows":
|
||||
py = venv / "Scripts" / "python.exe"
|
||||
else:
|
||||
py = venv / "bin" / "python"
|
||||
|
||||
print("[2/4] 安装依赖...")
|
||||
subprocess.check_call([str(py), "-m", "pip", "install", "--upgrade", "pip"])
|
||||
subprocess.check_call([str(py), "-m", "pip", "install", "-r", "requirements.txt"])
|
||||
|
||||
print("[3/4] 清理旧产物...")
|
||||
for d in ("build", "dist"):
|
||||
if (ROOT / d).exists():
|
||||
shutil.rmtree(ROOT / d)
|
||||
for f in ROOT.glob("*.spec.bak"):
|
||||
f.unlink()
|
||||
|
||||
print("[4/4] 开始 PyInstaller 打包...")
|
||||
subprocess.check_call([str(py), "-m", "PyInstaller", "build.spec", "--clean", "--noconfirm"])
|
||||
|
||||
exe_name = "SSHClient.exe" if platform.system() == "Windows" else "SSHClient"
|
||||
out = ROOT / "dist" / exe_name
|
||||
if out.exists():
|
||||
size_mb = out.stat().st_size / 1024 / 1024
|
||||
print()
|
||||
print("=" * 50)
|
||||
print(f" ✓ 打包完成: {out}")
|
||||
print(f" ✓ 大小: {size_mb:.1f} MB")
|
||||
print("=" * 50)
|
||||
else:
|
||||
print("[X] 打包未产出文件,请检查 PyInstaller 输出")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user