unifypy 2.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. unifypy/__init__.py +7 -0
  2. unifypy/__main__.py +21 -0
  3. unifypy/cli/__init__.py +10 -0
  4. unifypy/cli/argument_parser.py +209 -0
  5. unifypy/core/__init__.py +8 -0
  6. unifypy/core/config.py +491 -0
  7. unifypy/core/context.py +36 -0
  8. unifypy/core/engine.py +93 -0
  9. unifypy/core/environment.py +509 -0
  10. unifypy/core/event_bus.py +37 -0
  11. unifypy/core/events.py +16 -0
  12. unifypy/core/platforms.py +58 -0
  13. unifypy/core/plugin.py +65 -0
  14. unifypy/core/validators/__init__.py +10 -0
  15. unifypy/core/validators/tool_validator.py +144 -0
  16. unifypy/platforms/__init__.py +10 -0
  17. unifypy/platforms/base.py +127 -0
  18. unifypy/platforms/linux/__init__.py +10 -0
  19. unifypy/platforms/linux/deb_packager.py +289 -0
  20. unifypy/platforms/linux/rpm_packager.py +332 -0
  21. unifypy/platforms/macos/__init__.py +10 -0
  22. unifypy/platforms/macos/dmg_packager.py +477 -0
  23. unifypy/platforms/macos/post_processor.py +272 -0
  24. unifypy/platforms/registry.py +108 -0
  25. unifypy/platforms/windows/__init__.py +9 -0
  26. unifypy/platforms/windows/inno_setup.py +715 -0
  27. unifypy/plugins/__init__.py +3 -0
  28. unifypy/plugins/auto_rollback_plugin.py +156 -0
  29. unifypy/plugins/cleanup_plugin.py +22 -0
  30. unifypy/plugins/config_plugin.py +42 -0
  31. unifypy/plugins/dry_run_plugin.py +22 -0
  32. unifypy/plugins/environment_plugin.py +61 -0
  33. unifypy/plugins/external_plugins_loader.py +42 -0
  34. unifypy/plugins/packaging_plugin.py +125 -0
  35. unifypy/plugins/prepare_plugin.py +89 -0
  36. unifypy/plugins/progress_plugin.py +32 -0
  37. unifypy/plugins/pyinstaller_plugin.py +95 -0
  38. unifypy/plugins/rollback_plugin.py +62 -0
  39. unifypy/plugins/summary_plugin.py +36 -0
  40. unifypy/plugins/windows_language_plugin.py +85 -0
  41. unifypy/pyinstaller/__init__.py +7 -0
  42. unifypy/pyinstaller/config_builder.py +908 -0
  43. unifypy/templates/ChineseSimplified.isl.template +403 -0
  44. unifypy/templates/setup.iss.template +51 -0
  45. unifypy/tools/create-dmg/.this-is-the-create-dmg-repo +3 -0
  46. unifypy/tools/create-dmg/LICENSE +22 -0
  47. unifypy/tools/create-dmg/Makefile +33 -0
  48. unifypy/tools/create-dmg/README.md +126 -0
  49. unifypy/tools/create-dmg/builder/create-dmg.builder +26 -0
  50. unifypy/tools/create-dmg/create-dmg +621 -0
  51. unifypy/tools/create-dmg/doc-project/Developer Notes.md +35 -0
  52. unifypy/tools/create-dmg/doc-project/Release Checklist.md +10 -0
  53. unifypy/tools/create-dmg/examples/01-main-example/installer_background.png +0 -0
  54. unifypy/tools/create-dmg/examples/01-main-example/sample +30 -0
  55. unifypy/tools/create-dmg/examples/01-main-example/source_folder/Application.app +0 -0
  56. unifypy/tools/create-dmg/support/eula-resources-template.xml +105 -0
  57. unifypy/tools/create-dmg/support/template.applescript +74 -0
  58. unifypy/tools/create-dmg/tests/007-space-in-dir-name/my files/hello.txt +1 -0
  59. unifypy/tools/create-dmg/tests/007-space-in-dir-name/run-test +5 -0
  60. unifypy/utils/__init__.py +10 -0
  61. unifypy/utils/cache_manager.py +957 -0
  62. unifypy/utils/command_runner.py +195 -0
  63. unifypy/utils/entitlements_generator.py +450 -0
  64. unifypy/utils/file_ops.py +333 -0
  65. unifypy/utils/icon_converter.py +144 -0
  66. unifypy/utils/info_plist_updater.py +247 -0
  67. unifypy/utils/macos_codesign.py +225 -0
  68. unifypy/utils/parallel_builder.py +355 -0
  69. unifypy/utils/progress.py +371 -0
  70. unifypy/utils/progress_callback_factory.py +56 -0
  71. unifypy/utils/rollback.py +484 -0
  72. unifypy/utils/tool_manager.py +701 -0
  73. unifypy-2.0.2.dist-info/METADATA +609 -0
  74. unifypy-2.0.2.dist-info/RECORD +78 -0
  75. unifypy-2.0.2.dist-info/WHEEL +5 -0
  76. unifypy-2.0.2.dist-info/entry_points.txt +2 -0
  77. unifypy-2.0.2.dist-info/licenses/LICENSE +21 -0
  78. unifypy-2.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 工具验证器
5
+ 负责检查平台特定的打包器工具是否可用
6
+ """
7
+
8
+ from typing import List, Dict, Any
9
+
10
+
11
+ class ToolValidator:
12
+ """
13
+ 工具验证器,检查打包所需的工具是否可用.
14
+ """
15
+
16
+ def __init__(self, tool_manager, progress_manager=None):
17
+ """
18
+ 初始化工具验证器.
19
+
20
+ Args:
21
+ tool_manager: 工具管理器实例
22
+ progress_manager: 进度管理器实例(可选)
23
+ """
24
+ self.tool_manager = tool_manager
25
+ self.progress = progress_manager
26
+
27
+ def check_platform_tools(
28
+ self,
29
+ platform: str,
30
+ verbose: bool = False
31
+ ) -> List[Dict[str, Any]]:
32
+ """
33
+ 检查指定平台的工具是否可用.
34
+
35
+ Args:
36
+ platform: 平台名称 (windows/macos/linux)
37
+ verbose: 是否显示详细信息
38
+
39
+ Returns:
40
+ List[Dict]: 缺失的工具列表
41
+
42
+ Raises:
43
+ RuntimeError: 如果有工具缺失且强制检查
44
+ """
45
+ # 获取需要检测的工具
46
+ required_tools = self.tool_manager.get_required_tools_for_platform(
47
+ platform
48
+ )
49
+
50
+ if not required_tools:
51
+ # 没有需要检测的工具
52
+ return []
53
+
54
+ missing_tools = []
55
+
56
+ for tool_info in required_tools:
57
+ tool_name = tool_info["name"]
58
+ tool_display_name = tool_info["display_name"]
59
+
60
+ # 检查工具是否可用
61
+ is_available = self.tool_manager.check_tool_available(tool_name)
62
+
63
+ if not is_available:
64
+ missing_tools.append(tool_info)
65
+ if self.progress and verbose:
66
+ self.progress.warning(f"⚠️ 未找到 {tool_display_name}")
67
+
68
+ return missing_tools
69
+
70
+ def validate_and_raise(self, platform: str, verbose: bool = False):
71
+ """
72
+ 检查工具并在缺失时抛出异常.
73
+
74
+ Args:
75
+ platform: 平台名称
76
+ verbose: 是否显示详细信息
77
+
78
+ Raises:
79
+ RuntimeError: 如果有工具缺失
80
+ """
81
+ missing_tools = self.check_platform_tools(platform, verbose)
82
+
83
+ if missing_tools:
84
+ self._display_missing_tools_error(missing_tools)
85
+ raise RuntimeError("请安装缺失的打包工具后重试")
86
+
87
+ def _display_missing_tools_error(self, missing_tools: List[Dict[str, Any]]):
88
+ """
89
+ 显示缺失工具的详细错误信息.
90
+
91
+ Args:
92
+ missing_tools: 缺失的工具列表
93
+ """
94
+ print("\n" + "=" * 70)
95
+ print("❌ 缺少必要的打包工具")
96
+ print("=" * 70)
97
+
98
+ for tool_info in missing_tools:
99
+ print(f"\n📦 工具: {tool_info['display_name']}")
100
+ print(f" 描述: {tool_info['description']}")
101
+ print(f" 下载地址: {tool_info['download_url']}")
102
+
103
+ if "install_instructions" in tool_info:
104
+ print(" 安装说明:")
105
+ for instruction in tool_info["install_instructions"]:
106
+ print(f" {instruction}")
107
+
108
+ if "config_example" in tool_info:
109
+ print(" 或在配置文件中指定路径:")
110
+ print(f" {tool_info['config_example']}")
111
+
112
+ print("\n" + "=" * 70)
113
+
114
+ def get_missing_tools_summary(
115
+ self,
116
+ platform: str
117
+ ) -> Dict[str, Any]:
118
+ """
119
+ 获取缺失工具的摘要信息.
120
+
121
+ Args:
122
+ platform: 平台名称
123
+
124
+ Returns:
125
+ Dict: 包含缺失工具数量和列表的字典
126
+ """
127
+ missing_tools = self.check_platform_tools(platform, verbose=False)
128
+
129
+ return {
130
+ "platform": platform,
131
+ "total_required": len(
132
+ self.tool_manager.get_required_tools_for_platform(platform)
133
+ ),
134
+ "missing_count": len(missing_tools),
135
+ "missing_tools": [
136
+ {
137
+ "name": tool["name"],
138
+ "display_name": tool["display_name"],
139
+ "description": tool["description"]
140
+ }
141
+ for tool in missing_tools
142
+ ],
143
+ "all_available": len(missing_tools) == 0
144
+ }
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 平台特定打包器模块.
5
+ """
6
+
7
+ from .base import BasePackager
8
+ from .registry import PackagerRegistry
9
+
10
+ __all__ = ["BasePackager", "PackagerRegistry"]
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 平台打包器基类.
5
+ """
6
+
7
+ from unifypy.core.platforms import normalize_platform
8
+ from abc import ABC, abstractmethod
9
+ from pathlib import Path
10
+ from typing import Any, Dict, List
11
+
12
+
13
+ class BasePackager(ABC):
14
+ """
15
+ 平台打包器基类.
16
+ """
17
+
18
+ def __init__(self, progress_manager, runner, tool_manager, config: Dict[str, Any], config_file_path: str = None):
19
+ """初始化打包器.
20
+
21
+ Args:
22
+ progress_manager: 进度管理器
23
+ runner: 命令执行器
24
+ tool_manager: 工具管理器
25
+ config: 配置字典
26
+ config_file_path: 配置文件路径(可选)
27
+ """
28
+ self.progress = progress_manager
29
+ self.runner = runner
30
+ self.tool_manager = tool_manager
31
+ self.config = config
32
+ self.config_file_path = config_file_path or "build.json"
33
+ self.current_platform = self._detect_platform()
34
+ # 初始化环境管理器
35
+ from ..core.environment import EnvironmentManager
36
+ self.env_manager = EnvironmentManager(".")
37
+
38
+ def _detect_platform(self) -> str:
39
+ """
40
+ 检测当前平台.
41
+ """
42
+ return normalize_platform()
43
+
44
+ @abstractmethod
45
+ def get_supported_formats(self) -> List[str]:
46
+ """获取支持的打包格式.
47
+
48
+ Returns:
49
+ List[str]: 支持的格式列表
50
+ """
51
+
52
+ @abstractmethod
53
+ def can_package_format(self, format_type: str) -> bool:
54
+ """检查是否支持指定格式.
55
+
56
+ Args:
57
+ format_type: 打包格式
58
+
59
+ Returns:
60
+ bool: 是否支持
61
+ """
62
+
63
+ @abstractmethod
64
+ def package(self, format_type: str, source_path: Path, output_path: Path) -> bool:
65
+ """执行打包.
66
+
67
+ Args:
68
+ format_type: 打包格式
69
+ source_path: 源文件/目录路径
70
+ output_path: 输出路径
71
+
72
+ Returns:
73
+ bool: 打包是否成功
74
+ """
75
+
76
+ def validate_config(self, format_type: str) -> List[str]:
77
+ """验证配置.
78
+
79
+ Args:
80
+ format_type: 打包格式
81
+
82
+ Returns:
83
+ List[str]: 验证错误列表
84
+ """
85
+ return []
86
+
87
+ def get_output_filename(self, format_type: str, app_name: str, version: str, use_modern_naming: bool = False) -> str:
88
+ """生成输出文件名 (支持现代化命名).
89
+
90
+ Args:
91
+ format_type: 打包格式
92
+ app_name: 应用名称
93
+ version: 版本号
94
+ use_modern_naming: 是否使用现代化命名 (内部架构键)
95
+
96
+ Returns:
97
+ str: 输出文件名
98
+ """
99
+ if use_modern_naming and format_type not in ["deb", "rpm"]:
100
+ # 现代化命名:使用内部架构键
101
+ return self.env_manager.get_modern_filename(app_name, version, format_type)
102
+ else:
103
+ # 传统命名:兼容现有系统
104
+ return self.env_manager.get_legacy_format_filename(app_name, version, format_type)
105
+
106
+ def ensure_output_dir(self, output_path: Path) -> None:
107
+ """确保输出目录存在.
108
+
109
+ Args:
110
+ output_path: 输出路径
111
+ """
112
+ output_dir = output_path.parent
113
+ output_dir.mkdir(parents=True, exist_ok=True)
114
+
115
+ def get_format_config(self, format_type: str) -> Dict[str, Any]:
116
+ """获取格式特定的配置.
117
+
118
+ Args:
119
+ format_type: 打包格式
120
+
121
+ Returns:
122
+ Dict[str, Any]: 格式配置
123
+ """
124
+ platform_config = self.config.get("platforms", {}).get(
125
+ self.current_platform, {}
126
+ )
127
+ return platform_config.get(format_type, {})
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Linux平台打包器.
5
+ """
6
+
7
+ from .deb_packager import DEBPackager
8
+ from .rpm_packager import RPMPackager
9
+
10
+ __all__ = ["DEBPackager", "RPMPackager"]
@@ -0,0 +1,289 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Linux DEB 打包器 创建Debian/Ubuntu格式的安装包.
5
+ """
6
+
7
+ import os
8
+ import shutil
9
+ import tempfile
10
+ from pathlib import Path
11
+ from typing import Any, Dict, List
12
+
13
+ from ..base import BasePackager
14
+
15
+
16
+ class DEBPackager(BasePackager):
17
+ """
18
+ DEB 打包器.
19
+ """
20
+
21
+ def get_supported_formats(self) -> List[str]:
22
+ """
23
+ 获取支持的打包格式.
24
+ """
25
+ return ["deb"]
26
+
27
+ def can_package_format(self, format_type: str) -> bool:
28
+ """
29
+ 检查是否支持指定格式.
30
+ """
31
+ return format_type in self.get_supported_formats()
32
+
33
+ def package(self, format_type: str, source_path: Path, output_path: Path) -> bool:
34
+ """执行DEB打包.
35
+
36
+ Args:
37
+ format_type: 打包格式 (deb)
38
+ source_path: PyInstaller生成的应用路径
39
+ output_path: 输出DEB文件路径
40
+
41
+ Returns:
42
+ bool: 打包是否成功
43
+ """
44
+ if not self.can_package_format(format_type):
45
+ self.progress.on_error(
46
+ Exception(f"不支持的格式: {format_type}"), "Linux DEB打包"
47
+ )
48
+ return False
49
+
50
+ # 获取DEB配置
51
+ deb_config = self.get_format_config("deb")
52
+
53
+ # 创建临时构建目录
54
+ with tempfile.TemporaryDirectory() as temp_dir:
55
+ build_dir = Path(temp_dir) / "build"
56
+ debian_dir = build_dir / "DEBIAN"
57
+
58
+ # 创建目录结构
59
+ debian_dir.mkdir(parents=True)
60
+
61
+ # 安装应用文件
62
+ self._install_application(source_path, build_dir, deb_config)
63
+
64
+ # 创建控制文件
65
+ self._create_control_file(debian_dir, deb_config)
66
+
67
+ # 创建脚本文件
68
+ self._create_scripts(debian_dir, deb_config)
69
+
70
+ # 创建桌面文件
71
+ self._create_desktop_file(build_dir, deb_config)
72
+
73
+ # 构建DEB包
74
+ success = self._build_deb_package(build_dir, output_path)
75
+
76
+ return success
77
+
78
+ def _install_application(
79
+ self, source_path: Path, build_dir: Path, config: Dict[str, Any]
80
+ ):
81
+ """
82
+ 安装应用文件到构建目录.
83
+ """
84
+ app_name = self.config.get("name", "myapp").lower()
85
+ install_dir = build_dir / "opt" / app_name
86
+
87
+ # 创建安装目录
88
+ install_dir.mkdir(parents=True)
89
+
90
+ if source_path.is_file():
91
+ # 单个可执行文件
92
+ shutil.copy2(source_path, install_dir / app_name)
93
+ (install_dir / app_name).chmod(0o755)
94
+ else:
95
+ # 目录 - 复制所有内容
96
+ for item in source_path.iterdir():
97
+ if item.is_file():
98
+ shutil.copy2(item, install_dir)
99
+ else:
100
+ shutil.copytree(item, install_dir / item.name)
101
+
102
+ # 创建符号链接到 /usr/local/bin
103
+ bin_dir = build_dir / "usr" / "local" / "bin"
104
+ bin_dir.mkdir(parents=True)
105
+
106
+ # 创建启动脚本
107
+ launcher_script = bin_dir / app_name
108
+ launcher_content = f"""#!/bin/bash
109
+ cd /opt/{app_name}
110
+ exec ./{app_name} "$@"
111
+ """
112
+
113
+ with open(launcher_script, "w") as f:
114
+ f.write(launcher_content)
115
+ launcher_script.chmod(0o755)
116
+
117
+ def _create_control_file(self, debian_dir: Path, config: Dict[str, Any]):
118
+ """
119
+ 创建DEBIAN/control文件.
120
+ """
121
+ app_name = self.config.get("name", "myapp").lower()
122
+ version = self.config.get("version", "1.0.0")
123
+
124
+ # 使用环境管理器获取标准化的架构信息
125
+ arch = self.env_manager.get_arch_for_format("deb")
126
+
127
+ control_content = f"""Package: {app_name}
128
+ Version: {version}
129
+ Section: {config.get('section', 'utils')}
130
+ Priority: {config.get('priority', 'optional')}
131
+ Architecture: {arch}
132
+ Maintainer: {config.get('maintainer', self.config.get('publisher', 'Unknown <unknown@example.com>'))}
133
+ Description: {config.get('description', self.config.get('display_name', app_name))}
134
+ """
135
+
136
+ # 添加依赖
137
+ depends = config.get("depends", [])
138
+ if depends:
139
+ if isinstance(depends, list):
140
+ depends_str = ", ".join(depends)
141
+ else:
142
+ depends_str = str(depends)
143
+ control_content += f"Depends: {depends_str}\n"
144
+
145
+ # 添加冲突
146
+ conflicts = config.get("conflicts", [])
147
+ if conflicts:
148
+ if isinstance(conflicts, list):
149
+ conflicts_str = ", ".join(conflicts)
150
+ else:
151
+ conflicts_str = str(conflicts)
152
+ control_content += f"Conflicts: {conflicts_str}\n"
153
+
154
+ # 添加推荐和建议
155
+ recommends = config.get("recommends", [])
156
+ if recommends:
157
+ if isinstance(recommends, list):
158
+ recommends_str = ", ".join(recommends)
159
+ else:
160
+ recommends_str = str(recommends)
161
+ control_content += f"Recommends: {recommends_str}\n"
162
+
163
+ suggests = config.get("suggests", [])
164
+ if suggests:
165
+ if isinstance(suggests, list):
166
+ suggests_str = ", ".join(suggests)
167
+ else:
168
+ suggests_str = str(suggests)
169
+ control_content += f"Suggests: {suggests_str}\n"
170
+
171
+ # 添加首页
172
+ homepage = config.get("homepage")
173
+ if homepage:
174
+ control_content += f"Homepage: {homepage}\n"
175
+
176
+ # 写入控制文件
177
+ with open(debian_dir / "control", "w") as f:
178
+ f.write(control_content)
179
+
180
+ def _create_scripts(self, debian_dir: Path, config: Dict[str, Any]):
181
+ """
182
+ 创建维护脚本.
183
+ """
184
+ scripts = ["preinst", "postinst", "prerm", "postrm"]
185
+
186
+ for script in scripts:
187
+ script_content = config.get(f"{script}_script")
188
+ if script_content:
189
+ script_file = debian_dir / script
190
+ with open(script_file, "w") as f:
191
+ f.write("#!/bin/bash\n")
192
+ f.write(script_content)
193
+ script_file.chmod(0o755)
194
+
195
+ def _create_desktop_file(self, build_dir: Path, config: Dict[str, Any]):
196
+ """
197
+ 创建桌面文件.
198
+ """
199
+ if not config.get("create_desktop_file", True):
200
+ return
201
+
202
+ app_name = self.config.get("name", "myapp")
203
+ display_name = self.config.get("display_name", app_name)
204
+
205
+ # 创建applications目录
206
+ apps_dir = build_dir / "usr" / "share" / "applications"
207
+ apps_dir.mkdir(parents=True)
208
+
209
+ # 桌面文件内容
210
+ desktop_content = f"""[Desktop Entry]
211
+ Type=Application
212
+ Name={display_name}
213
+ Exec={app_name.lower()}
214
+ Icon={app_name.lower()}
215
+ Comment={config.get('description', display_name)}
216
+ Categories={config.get('categories', 'Utility;')}
217
+ Terminal={str(config.get('terminal', False)).lower()}
218
+ """
219
+
220
+ # 写入桌面文件
221
+ desktop_file = apps_dir / f"{app_name.lower()}.desktop"
222
+ with open(desktop_file, "w") as f:
223
+ f.write(desktop_content)
224
+
225
+ # 复制图标文件
226
+ icon_path = config.get("icon") or self.config.get("icon")
227
+ if icon_path and os.path.exists(icon_path):
228
+ # 创建图标目录
229
+ icon_dir = build_dir / "usr" / "share" / "pixmaps"
230
+ icon_dir.mkdir(parents=True)
231
+
232
+ # 复制图标
233
+ icon_ext = Path(icon_path).suffix
234
+ icon_dest = icon_dir / f"{app_name.lower()}{icon_ext}"
235
+ shutil.copy2(icon_path, icon_dest)
236
+
237
+ def _build_deb_package(self, build_dir: Path, output_path: Path) -> bool:
238
+ """
239
+ 构建DEB包.
240
+ """
241
+ # 确保输出目录存在
242
+ self.ensure_output_dir(output_path)
243
+
244
+ # 使用dpkg-deb构建包
245
+ command = ["dpkg-deb", "--build", str(build_dir), str(output_path)]
246
+
247
+ success = self.runner.run_command(
248
+ command, "Linux DEB打包", "正在构建DEB包...", 80, shell=False
249
+ )
250
+
251
+ if success and output_path.exists():
252
+ return True
253
+ else:
254
+ self.progress.on_error(
255
+ Exception(f"DEB包生成失败: {output_path}"), "Linux DEB打包"
256
+ )
257
+ return False
258
+
259
+ def validate_config(self, format_type: str) -> List[str]:
260
+ """
261
+ 验证DEB配置.
262
+ """
263
+ errors = []
264
+
265
+ config = self.get_format_config("deb")
266
+
267
+ # 检查必需字段
268
+ required_fields = ["maintainer"]
269
+ for field in required_fields:
270
+ if not config.get(field):
271
+ errors.append(f"DEB配置缺少必需字段: {field}")
272
+
273
+ # 检查图标文件
274
+ icon_path = config.get("icon") or self.config.get("icon")
275
+ if icon_path and not os.path.exists(icon_path):
276
+ errors.append(f"图标文件不存在: {icon_path}")
277
+
278
+ # 检查dpkg-deb工具
279
+ try:
280
+ import shutil
281
+
282
+ if not shutil.which("dpkg-deb"):
283
+ errors.append(
284
+ "dpkg-deb工具未安装,请安装: sudo apt-get install dpkg-dev"
285
+ )
286
+ except:
287
+ errors.append("无法检查dpkg-deb工具")
288
+
289
+ return errors