fix bug
This commit is contained in:
76
AGENTS.md
76
AGENTS.md
@@ -159,3 +159,79 @@ sudo ./build-app.sh
|
||||
2. 检查系统命令是否安装:`which parted mdadm lvm`
|
||||
3. 手动测试命令:`sudo lsblk -J`
|
||||
4. 检查权限:确保用户有 sudo 权限或已切换到 root
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 跨平台兼容性 (新增)
|
||||
|
||||
本项目现在支持 **Arch Linux** 和 **CentOS/RHEL 8** 两大平台,统一使用 **Tkinter** 作为 GUI 后端。
|
||||
|
||||
### 平台支持矩阵
|
||||
|
||||
| 平台 | Python版本 | GUI后端 | 状态 |
|
||||
|------|-----------|---------|------|
|
||||
| Arch Linux | 3.7+ | Tkinter | ✓ 完全支持 |
|
||||
| CentOS 8 | 3.6 | Tkinter | ✓ 完全支持 |
|
||||
| CentOS 8 Stream | 3.9+ | Tkinter | ✓ 完全支持 |
|
||||
| RHEL 8 | 3.6 | Tkinter | ✓ 完全支持 |
|
||||
| Ubuntu/Debian | 3.x | Tkinter | ✓ 支持 |
|
||||
|
||||
### 为什么统一使用 Tkinter?
|
||||
|
||||
- **Python 内置**: 无需额外安装
|
||||
- **跨版本兼容**: 支持 Python 3.6+ (包括 CentOS 8 的 Python 3.6)
|
||||
- **跨发行版**: 所有 Linux 发行版都支持
|
||||
- **打包简单**: PyInstaller 处理更稳定
|
||||
|
||||
### 新文件说明
|
||||
|
||||
- **`main.py`** - 统一入口点,使用 Tkinter
|
||||
- **`platform_compat.py`** - 平台检测模块
|
||||
- **`system_compat.py`** - 系统命令兼容性模块
|
||||
- **`build-compat.sh`** - 跨平台构建脚本
|
||||
- **`disk-manager-compat.spec`** - PyInstaller 兼容配置
|
||||
- **`run.sh`** - 启动脚本
|
||||
|
||||
### 启动方式
|
||||
|
||||
```bash
|
||||
# 统一入口(推荐)
|
||||
python3 main.py
|
||||
|
||||
# 或使用启动脚本
|
||||
./run.sh
|
||||
|
||||
# 或直接运行主模块
|
||||
python3 mainwindow_tkinter.py
|
||||
```
|
||||
|
||||
### Python 3.6 兼容性修改
|
||||
|
||||
为支持 CentOS 8 的 Python 3.6,进行了以下修改:
|
||||
|
||||
1. **system_info.py** - `_run_command()` 方法避免使用 `capture_output` 和 `text` 参数
|
||||
2. **platform_compat.py** - `_command_exists()` 使用 `stdout/stderr` 代替 `capture_output`
|
||||
3. **system_compat.py** - 版本检测使用 `stdout/stderr` 管道
|
||||
4. **smart_monitor.py** - 为 `dataclasses` 提供回退实现
|
||||
5. **disk_operations_tkinter.py** - 修复 f-string 中文引号问题
|
||||
|
||||
### 系统命令兼容性
|
||||
|
||||
| 命令 | Arch Linux | CentOS 8 |
|
||||
|------|-----------|----------|
|
||||
| lsblk | `lsblk -J` (JSON) | `lsblk -J` (JSON) |
|
||||
| lsblk 列 | 支持 PATH | 不支持 PATH,使用 KNAME |
|
||||
| LVM JSON | 支持 | 支持 |
|
||||
|
||||
### 构建打包
|
||||
|
||||
```bash
|
||||
# 使用新的构建脚本(自动检测平台)
|
||||
./build-compat.sh
|
||||
|
||||
# 或手动打包
|
||||
pyinstaller -F disk-manager-compat.spec
|
||||
```
|
||||
|
||||
打包后的可执行文件可在两个系统上运行,启动时会自动检测并选择合适的 GUI 后端。
|
||||
|
||||
Reference in New Issue
Block a user