py-wlcli 0.8.0__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.
- py_wlcli-0.8.0.dist-info/METADATA +139 -0
- py_wlcli-0.8.0.dist-info/RECORD +320 -0
- py_wlcli-0.8.0.dist-info/WHEEL +4 -0
- py_wlcli-0.8.0.dist-info/entry_points.txt +2 -0
- py_wlcli-0.8.0.dist-info/licenses/LICENSE +21 -0
- wl_cli/__init__.py +27 -0
- wl_cli/__main__.py +130 -0
- wl_cli/capabilities.py +79 -0
- wl_cli/cc/__init__.py +5 -0
- wl_cli/cc/checks.py +1019 -0
- wl_cli/cc/cli.py +370 -0
- wl_cli/cc/mutate.py +1350 -0
- wl_cli/cli_click.py +156 -0
- wl_cli/commands/__init__.py +84 -0
- wl_cli/commands/base.py +80 -0
- wl_cli/commands/buildcommands/__init__.py +1 -0
- wl_cli/commands/buildcommands/build.py +71 -0
- wl_cli/commands/buildcommands/build_utils.py +47 -0
- wl_cli/commands/buildcommands/builders/__init__.py +18 -0
- wl_cli/commands/buildcommands/builders/cleanup.py +35 -0
- wl_cli/commands/buildcommands/builders/coordinator.py +122 -0
- wl_cli/commands/buildcommands/builders/environment.py +81 -0
- wl_cli/commands/buildcommands/builders/rust_builder.py +39 -0
- wl_cli/commands/buildcommands/builders/stubs.py +58 -0
- wl_cli/commands/buildcommands/dist.py +326 -0
- wl_cli/commands/buildcommands/test.py +89 -0
- wl_cli/commands/clean/__init__.py +1 -0
- wl_cli/commands/clean/build.py +151 -0
- wl_cli/commands/clean/clean.py +294 -0
- wl_cli/commands/clean/clean_utils.py +77 -0
- wl_cli/commands/clean/core.py +236 -0
- wl_cli/commands/clean/dead_code/__init__.py +0 -0
- wl_cli/commands/clean/dead_code/dead_code_command.py +70 -0
- wl_cli/commands/clean/dead_code/detector.py +161 -0
- wl_cli/commands/clean/dead_code/fixer.py +176 -0
- wl_cli/commands/clean/dead_code/reporter.py +295 -0
- wl_cli/commands/clean/dead_code/utils.py +0 -0
- wl_cli/commands/clean/lfs.py +215 -0
- wl_cli/commands/clean/python.py +81 -0
- wl_cli/commands/clean/rust.py +91 -0
- wl_cli/commands/clean/utils/__init__.py +34 -0
- wl_cli/commands/clean/venv.py +91 -0
- wl_cli/commands/cleanup.py +73 -0
- wl_cli/commands/click_base.py +79 -0
- wl_cli/commands/config/__init__.py +1 -0
- wl_cli/commands/config/config.py +291 -0
- wl_cli/commands/debug/__init__.py +6 -0
- wl_cli/commands/debug/debug.py +309 -0
- wl_cli/commands/debug/debug_cache.py +86 -0
- wl_cli/commands/debug/debug_subagent.py +156 -0
- wl_cli/commands/debug/output_formatter.py +165 -0
- wl_cli/commands/debug/source_hasher.py +92 -0
- wl_cli/commands/format/__init__.py +13 -0
- wl_cli/commands/format/format_cache_adapter.py +125 -0
- wl_cli/commands/format/format_command.py +197 -0
- wl_cli/commands/format/format_coordinator.py +191 -0
- wl_cli/commands/format/format_executor.py +470 -0
- wl_cli/commands/format/format_outcome.py +44 -0
- wl_cli/commands/format/format_path_handler.py +1016 -0
- wl_cli/commands/format/format_progress.py +62 -0
- wl_cli/commands/format/format_reporter.py +31 -0
- wl_cli/commands/format/python_formatter.py +506 -0
- wl_cli/commands/format/rust_formatter.py +106 -0
- wl_cli/commands/gate/__init__.py +1 -0
- wl_cli/commands/gate/gate_command.py +862 -0
- wl_cli/commands/gate/preflight.py +445 -0
- wl_cli/commands/git/__init__.py +1 -0
- wl_cli/commands/git/config.py +169 -0
- wl_cli/commands/git/git_facts.py +60 -0
- wl_cli/commands/git/git_flow.py +86 -0
- wl_cli/commands/git/hook.py +112 -0
- wl_cli/commands/git/policy.py +216 -0
- wl_cli/commands/git/push_update.py +82 -0
- wl_cli/commands/initenv/__init__.py +1 -0
- wl_cli/commands/initenv/common/__init__.py +23 -0
- wl_cli/commands/initenv/common/check_git_bash.py +78 -0
- wl_cli/commands/initenv/common/error_handler.py +68 -0
- wl_cli/commands/initenv/common/exceptions.py +52 -0
- wl_cli/commands/initenv/components/__init__.py +4 -0
- wl_cli/commands/initenv/components/cargo_sync.py +240 -0
- wl_cli/commands/initenv/components/config_manager.py +106 -0
- wl_cli/commands/initenv/components/directory_utils.py +71 -0
- wl_cli/commands/initenv/components/git/__init__.py +9 -0
- wl_cli/commands/initenv/components/git/branch_creator.py +143 -0
- wl_cli/commands/initenv/components/git/git_flow_interface.py +24 -0
- wl_cli/commands/initenv/components/git/git_flow_manager.py +159 -0
- wl_cli/commands/initenv/components/git/git_lfs_manager.py +272 -0
- wl_cli/commands/initenv/components/git/git_utility.py +254 -0
- wl_cli/commands/initenv/components/git/gitignore_manager.py +53 -0
- wl_cli/commands/initenv/components/git_initializer.py +212 -0
- wl_cli/commands/initenv/components/i18n_manager.py +104 -0
- wl_cli/commands/initenv/components/log_manager.py +241 -0
- wl_cli/commands/initenv/components/project_structure/__init__.py +23 -0
- wl_cli/commands/initenv/components/project_structure/config_generator.py +360 -0
- wl_cli/commands/initenv/components/project_structure/directory_creator.py +184 -0
- wl_cli/commands/initenv/components/project_structure/hook_source.py +110 -0
- wl_cli/commands/initenv/components/project_structure/hooks_manager.py +995 -0
- wl_cli/commands/initenv/components/project_structure/readme_handler.py +56 -0
- wl_cli/commands/initenv/components/project_structure/rust_files_handler.py +30 -0
- wl_cli/commands/initenv/components/project_structure/setup_handler.py +103 -0
- wl_cli/commands/initenv/components/project_structure/sop_generator.py +73 -0
- wl_cli/commands/initenv/components/project_structure/template_copier.py +104 -0
- wl_cli/commands/initenv/components/project_structure/template_manager.py +195 -0
- wl_cli/commands/initenv/components/pyproject_generator.py +194 -0
- wl_cli/commands/initenv/components/rust_initializer.py +145 -0
- wl_cli/commands/initenv/components/symlink_cleaner.py +99 -0
- wl_cli/commands/initenv/components/symlink_manager.py +52 -0
- wl_cli/commands/initenv/components/venv_manager.py +118 -0
- wl_cli/commands/initenv/initenv.py +169 -0
- wl_cli/commands/initenv/services/__init__.py +11 -0
- wl_cli/commands/initenv/services/environment_initializer.py +288 -0
- wl_cli/commands/initenv/services/git_lfs_initializer.py +26 -0
- wl_cli/commands/initenv/services/project_structure_initializer.py +52 -0
- wl_cli/commands/lfs/README.md +221 -0
- wl_cli/commands/lfs/__init__.py +5 -0
- wl_cli/commands/lfs/cli.py +106 -0
- wl_cli/commands/lfs/config.py +164 -0
- wl_cli/commands/lfs/hook.py +61 -0
- wl_cli/commands/lfs/initializer.py +531 -0
- wl_cli/commands/lfs/manager.py +95 -0
- wl_cli/commands/lfs/policy.py +165 -0
- wl_cli/commands/lfs/watcher.py +294 -0
- wl_cli/commands/lint/__init__.py +1 -0
- wl_cli/commands/lint/lint_command.py +297 -0
- wl_cli/commands/lint/lint_executor.py +409 -0
- wl_cli/commands/lint/lint_reporter.py +579 -0
- wl_cli/commands/lint/lint_run.py +258 -0
- wl_cli/commands/lint/mypy_config.py +90 -0
- wl_cli/commands/registry.py +103 -0
- wl_cli/commands/self/__init__.py +7 -0
- wl_cli/commands/self/common/__init__.py +8 -0
- wl_cli/commands/self/common/capabilities.py +30 -0
- wl_cli/commands/self/common/config.py +27 -0
- wl_cli/commands/self/common/version_cache.py +85 -0
- wl_cli/commands/self/handlers/__init__.py +19 -0
- wl_cli/commands/self/handlers/base_handler.py +28 -0
- wl_cli/commands/self/handlers/install_handler.py +85 -0
- wl_cli/commands/self/handlers/status_handler.py +66 -0
- wl_cli/commands/self/handlers/uninstall_handler.py +58 -0
- wl_cli/commands/self/handlers/update_handler.py +102 -0
- wl_cli/commands/self/handlers/version_handler.py +16 -0
- wl_cli/commands/self/self_command.py +237 -0
- wl_cli/commands/self/services/__init__.py +15 -0
- wl_cli/commands/self/services/installation_manager.py +187 -0
- wl_cli/commands/self/services/local_installer.py +165 -0
- wl_cli/commands/self/services/pypi_updater.py +278 -0
- wl_cli/commands/self/services/windows_update.py +174 -0
- wl_cli/commands/testcommands/__init__.py +8 -0
- wl_cli/commands/testcommands/base_dependency_analyzer.py +198 -0
- wl_cli/commands/testcommands/batch_processor.py +278 -0
- wl_cli/commands/testcommands/cache_manager.py +1156 -0
- wl_cli/commands/testcommands/coverage_analyzer.py +955 -0
- wl_cli/commands/testcommands/coverage_cache_manager.py +183 -0
- wl_cli/commands/testcommands/progress_manager.py +79 -0
- wl_cli/commands/testcommands/python_env_detector.py +207 -0
- wl_cli/commands/testcommands/report_generator.py +101 -0
- wl_cli/commands/testcommands/single_test_executor.py +250 -0
- wl_cli/commands/testcommands/speed_checker.py +118 -0
- wl_cli/commands/testcommands/test_command_builder.py +165 -0
- wl_cli/commands/testcommands/test_commands.py +786 -0
- wl_cli/commands/testcommands/test_reporter.py +181 -0
- wl_cli/commands/testcommands/test_result_handler.py +96 -0
- wl_cli/commands/testcommands/test_runner.py +1343 -0
- wl_cli/commands/testcommands/test_utils.py +197 -0
- wl_cli/commands/testcommands/utils/__init__.py +17 -0
- wl_cli/commands/testcommands/utils/coverage_parser.py +98 -0
- wl_cli/commands/testcommands/utils/env_info.py +36 -0
- wl_cli/commands/testcommands/utils/junit_parser.py +75 -0
- wl_cli/commands/testcommands/utils/markdown_utils.py +20 -0
- wl_cli/commands/testcommands/utils/project_root.py +61 -0
- wl_cli/commands/update/__init__.py +9 -0
- wl_cli/commands/update/services/__init__.py +21 -0
- wl_cli/commands/update/services/backup_manager.py +207 -0
- wl_cli/commands/update/services/component_manager.py +83 -0
- wl_cli/commands/update/services/conflict_resolver.py +189 -0
- wl_cli/commands/update/services/vendors_updater.py +85 -0
- wl_cli/commands/update/services/version_tracker.py +127 -0
- wl_cli/commands/update/update_command.py +270 -0
- wl_cli/commands/update/utils/__init__.py +3 -0
- wl_cli/commands/version/__init__.py +9 -0
- wl_cli/commands/version/version_command.py +155 -0
- wl_cli/commands/workflow.py +477 -0
- wl_cli/env/__init__.py +5 -0
- wl_cli/env/cli.py +167 -0
- wl_cli/env_status.py +157 -0
- wl_cli/envelope.py +91 -0
- wl_cli/exceptions.py +85 -0
- wl_cli/lib/__init__.py +3 -0
- wl_cli/lib/rust_utils.py +35 -0
- wl_cli/mcp/__init__.py +6 -0
- wl_cli/mcp/capabilities.py +19 -0
- wl_cli/mcp/cli.py +22 -0
- wl_cli/mcp/gitlab.py +553 -0
- wl_cli/mcp/k8s.py +344 -0
- wl_cli/mcp/protocol.py +159 -0
- wl_cli/platform.py +139 -0
- wl_cli/quality/__init__.py +18 -0
- wl_cli/utils/__init__.py +7 -0
- wl_cli/utils/cache.py +491 -0
- wl_cli/utils/cache_ledger.py +355 -0
- wl_cli/utils/cache_store.py +546 -0
- wl_cli/utils/config/__init__.py +27 -0
- wl_cli/utils/config/config_loader.py +163 -0
- wl_cli/utils/config/core.py +862 -0
- wl_cli/utils/config/defaults.py +142 -0
- wl_cli/utils/config/env_exporter.py +86 -0
- wl_cli/utils/config/env_parser.py +108 -0
- wl_cli/utils/config/validation.py +280 -0
- wl_cli/utils/error_handler.py +165 -0
- wl_cli/utils/file_copier.py +56 -0
- wl_cli/utils/file_operations.py +506 -0
- wl_cli/utils/language_utils.py +122 -0
- wl_cli/utils/lazy_import.py +240 -0
- wl_cli/utils/log_levels.py +35 -0
- wl_cli/utils/log_rotators.py +74 -0
- wl_cli/utils/logging.py +458 -0
- wl_cli/utils/output_context.py +142 -0
- wl_cli/utils/performance/__init__.py +1 -0
- wl_cli/utils/performance/decorators.py +111 -0
- wl_cli/utils/performance/exporter.py +38 -0
- wl_cli/utils/performance/models.py +16 -0
- wl_cli/utils/performance/monitor.py +161 -0
- wl_cli/utils/performance_monitor.py +32 -0
- wl_cli/utils/platform_adapter.py +131 -0
- wl_cli/utils/pre_commit.py +266 -0
- wl_cli/utils/pre_commit_config.py +72 -0
- wl_cli/utils/root.py +521 -0
- wl_cli/utils/root_fallback.py +256 -0
- wl_cli/utils/run_evidence.py +236 -0
- wl_cli/utils/structured_logger.py +18 -0
- wl_cli/utils/structured_logging/__init__.py +19 -0
- wl_cli/utils/structured_logging/config.py +337 -0
- wl_cli/utils/structured_logging/core.py +177 -0
- wl_cli/utils/structured_logging/env.py +56 -0
- wl_cli/utils/structured_logging/filtering.py +75 -0
- wl_cli/utils/structured_logging/filters.py +55 -0
- wl_cli/utils/structured_logging/formatters.py +251 -0
- wl_cli/utils/structured_logging/handlers.py +308 -0
- wl_cli/utils/structured_logging/logger.py +354 -0
- wl_cli/utils/subprocess.py +71 -0
- wl_cli/utils/subprocess_utils.py +260 -0
- wl_cli/utils/test_utils/__init__.py +5 -0
- wl_cli/utils/test_utils/test_filter.py +36 -0
- wl_cli/utils/uv_run.py +79 -0
- wl_cli/utils/uv_tool.py +117 -0
- wl_cli/utils/uv_tree.py +71 -0
- wl_cli/utils/uv_workspace.py +174 -0
- wl_cli/utils/version/__init__.py +15 -0
- wl_cli/utils/version/pypi_version_checker.py +95 -0
- wl_cli/utils/version/version_comparator.py +133 -0
- wl_cli/utils/version/version_detectors.py +312 -0
- wl_cli/utils/version/version_service.py +131 -0
- wl_cli/utils/version/version_updater.py +198 -0
- wl_cli/utils/wl_dir_updater.py +1440 -0
- wl_cli/utils/workspace_detector/__init__.py +28 -0
- wl_cli/utils/workspace_detector/core.py +161 -0
- wl_cli/utils/workspace_detector/detection_strategies.py +107 -0
- wl_cli/utils/workspace_detector/exceptions.py +5 -0
- wl_cli/utils/workspace_detector/types.py +17 -0
- wl_cli/utils/workspace_detector/venv_resolver.py +84 -0
- wl_cli/vendors/config/.codespellrc +2 -0
- wl_cli/vendors/config/dependencies.toml +10 -0
- wl_cli/vendors/config/mypy.ini +62 -0
- wl_cli/vendors/config/pyproject_defaults.toml +28 -0
- wl_cli/vendors/config/template_config.toml +24 -0
- wl_cli/vendors/config/tool_configs.toml +76 -0
- wl_cli/vendors/git/.gitignore +122 -0
- wl_cli/vendors/git/.pre-commit-config.yaml +37 -0
- wl_cli/vendors/hooks/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/post-update.sample +8 -0
- wl_cli/vendors/hooks/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/pre-commit +45 -0
- wl_cli/vendors/hooks/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/pre-push.sample +60 -0
- wl_cli/vendors/hooks/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/push-to-checkout.sample +78 -0
- wl_cli/vendors/hooks/sendemail-validate.sample +77 -0
- wl_cli/vendors/hooks/unix/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/unix/check_lockfile.py +58 -0
- wl_cli/vendors/hooks/unix/check_lockfile.sh +36 -0
- wl_cli/vendors/hooks/unix/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/unix/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/unix/post-update.sample +8 -0
- wl_cli/vendors/hooks/unix/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/unix/pre-commit +190 -0
- wl_cli/vendors/hooks/unix/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/unix/pre-commit.py +81 -0
- wl_cli/vendors/hooks/unix/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/unix/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/unix/pre-push +417 -0
- wl_cli/vendors/hooks/unix/pre-push.sample +53 -0
- wl_cli/vendors/hooks/unix/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/unix/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/unix/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/update.sample +128 -0
- wl_cli/vendors/hooks/win/work.bat +63 -0
- wl_cli/vendors/project/.gitignore +90 -0
- wl_cli/vendors/project/.python-version +1 -0
- wl_cli/vendors/project/LICENSE +21 -0
- wl_cli/vendors/project/README.md +0 -0
- wl_cli/vendors/project/pyproject.toml +27 -0
- wl_cli/vendors/project/pyproject_no_workspace.toml +16 -0
- wl_cli/vendors/project/pyproject_workspace.toml +14 -0
- wl_cli/vendors/readme/README.md +120 -0
- wl_cli/vendors/rust/Cargo.toml +14 -0
- wl_cli/vendors/rust/lib/__init__.py +3 -0
- wl_cli/vendors/rust/lib/rust_utils.py +31 -0
- wl_cli/vendors/rust/src/lib.rs +13 -0
- wl_cli/vendors/rust/src/main.rs +3 -0
- wl_cli/vendors/rust/tests/test_rust_fallback.py +40 -0
- wl_cli/vendors/sop_doc/git-dev-sop.md +220 -0
- wl_cli/vendors/sop_doc/industrial-standard-sop.md +145 -0
- wl_cli/vendors/sop_doc/python-sop.md +342 -0
- wl_cli/vendors/sop_doc/rust-readme.md +219 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handler for self install subcommand.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from wl_cli.utils.logging import log_error_pair, log_info_pair
|
|
9
|
+
|
|
10
|
+
from ...self.common.config import SelfConfig
|
|
11
|
+
from ...self.services.installation_manager import InstallationManager
|
|
12
|
+
from ...self.services.pypi_updater import PypiUpdater
|
|
13
|
+
from .base_handler import BaseHandler
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class InstallHandler(BaseHandler):
|
|
17
|
+
"""Handler for the install subcommand - installs specified version."""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
version: str | None,
|
|
22
|
+
uv_path: str,
|
|
23
|
+
env: dict,
|
|
24
|
+
installation_manager: InstallationManager,
|
|
25
|
+
config: SelfConfig,
|
|
26
|
+
):
|
|
27
|
+
"""
|
|
28
|
+
Initialize the install handler.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
version: Version to install (None for latest)
|
|
32
|
+
uv_path: Path to uv executable
|
|
33
|
+
env: Environment variables
|
|
34
|
+
installation_manager: Installation manager instance
|
|
35
|
+
config: Self configuration
|
|
36
|
+
"""
|
|
37
|
+
self._version = version
|
|
38
|
+
self._uv_path = uv_path
|
|
39
|
+
self._env = env
|
|
40
|
+
self._installation_manager = installation_manager
|
|
41
|
+
self._config = config
|
|
42
|
+
|
|
43
|
+
def execute(self) -> None:
|
|
44
|
+
"""Execute the install subcommand."""
|
|
45
|
+
log_info_pair(
|
|
46
|
+
f"Installing wl version: {self._version or 'latest'}",
|
|
47
|
+
f"正在安装wl版本: {self._version or 'latest'}",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
log_info_pair(
|
|
51
|
+
f"Using configuration: {self._config.__dict__}",
|
|
52
|
+
f"使用配置: {self._config.__dict__}",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
# Initialize environment already done by caller
|
|
57
|
+
# Install specified version
|
|
58
|
+
log_info_pair(
|
|
59
|
+
"Step 3: Installing specified version...", "步骤3: 安装指定版本..."
|
|
60
|
+
)
|
|
61
|
+
pypi_updater = PypiUpdater()
|
|
62
|
+
# Update cache timeout based on config
|
|
63
|
+
if hasattr(pypi_updater, "_cache_timeout"):
|
|
64
|
+
pypi_updater._cache_timeout = self._config.cache_timeout
|
|
65
|
+
pypi_updater.install_version(self._uv_path, self._env, self._version)
|
|
66
|
+
|
|
67
|
+
log_info_pair(
|
|
68
|
+
"Step 4: Installation completed successfully!", "步骤4: 安装成功完成!"
|
|
69
|
+
)
|
|
70
|
+
except FileNotFoundError as e:
|
|
71
|
+
log_error_pair(f"Environment error: {e}", f"环境错误:{e}")
|
|
72
|
+
log_error_pair(
|
|
73
|
+
"Please ensure uv is installed and available in PATH",
|
|
74
|
+
"请确保uv已安装并在PATH中可用",
|
|
75
|
+
)
|
|
76
|
+
sys.exit(2)
|
|
77
|
+
except subprocess.CalledProcessError as e:
|
|
78
|
+
log_error_pair(f"Installation error: {e}", f"安装错误:{e}")
|
|
79
|
+
log_error_pair(
|
|
80
|
+
"Please check your network connection and version specification",
|
|
81
|
+
"请检查网络连接和版本规格",
|
|
82
|
+
)
|
|
83
|
+
sys.exit(3)
|
|
84
|
+
except Exception as e:
|
|
85
|
+
self.handle_error(e, 1)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handler for self status subcommand.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from wl_cli import __version__
|
|
6
|
+
from wl_cli.utils.config import get_config
|
|
7
|
+
from wl_cli.utils.logging import log_error_pair, log_info_pair
|
|
8
|
+
|
|
9
|
+
from ...self.services.pypi_updater import PypiUpdater
|
|
10
|
+
from .base_handler import BaseHandler
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class StatusHandler(BaseHandler):
|
|
14
|
+
"""Handler for the status subcommand - shows current status and update info."""
|
|
15
|
+
|
|
16
|
+
def __init__(self, cache_timeout: int):
|
|
17
|
+
"""
|
|
18
|
+
Initialize the status handler.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
cache_timeout: Cache timeout in seconds
|
|
22
|
+
"""
|
|
23
|
+
self._cache_timeout = cache_timeout
|
|
24
|
+
|
|
25
|
+
def execute(self) -> None:
|
|
26
|
+
"""Execute the status subcommand."""
|
|
27
|
+
# Get configuration
|
|
28
|
+
cache_enabled = get_config("cache_enabled", True)
|
|
29
|
+
cache_timeout = get_config("cache_timeout", 300)
|
|
30
|
+
|
|
31
|
+
log_info_pair(
|
|
32
|
+
f"Current wl version: {__version__}", f"当前wl版本: {__version__}"
|
|
33
|
+
)
|
|
34
|
+
log_info_pair(
|
|
35
|
+
f"Configuration: cache_enabled={cache_enabled}, cache_timeout={cache_timeout}",
|
|
36
|
+
f"配置: cache_enabled={cache_enabled}, cache_timeout={cache_timeout}",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
# Check for updates
|
|
41
|
+
pypi_updater = PypiUpdater()
|
|
42
|
+
# Update cache timeout based on config
|
|
43
|
+
if hasattr(pypi_updater, "_cache_timeout"):
|
|
44
|
+
pypi_updater._cache_timeout = cache_timeout
|
|
45
|
+
latest_version = pypi_updater.get_latest_version()
|
|
46
|
+
|
|
47
|
+
if latest_version > __version__:
|
|
48
|
+
log_info_pair(
|
|
49
|
+
f"A newer version is available: {latest_version}",
|
|
50
|
+
f"有新版本可用: {latest_version}",
|
|
51
|
+
)
|
|
52
|
+
log_info_pair(
|
|
53
|
+
"Run 'wl self update' to update", "运行 'wl self update' 进行更新"
|
|
54
|
+
)
|
|
55
|
+
else:
|
|
56
|
+
log_info_pair("You are using the latest version", "您正在使用最新版本")
|
|
57
|
+
except ConnectionError as e:
|
|
58
|
+
log_error_pair(f"Network error: {e}", f"网络错误:{e}")
|
|
59
|
+
log_error_pair(
|
|
60
|
+
"Please check your network connection and try again",
|
|
61
|
+
"请检查网络连接并重试",
|
|
62
|
+
)
|
|
63
|
+
except Exception as e:
|
|
64
|
+
log_error_pair(
|
|
65
|
+
f"Error checking for updates: {e}", f"错误:检查更新失败: {e}"
|
|
66
|
+
)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handler for self uninstall subcommand.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from wl_cli.utils.logging import log_error_pair, log_info_pair
|
|
9
|
+
|
|
10
|
+
from ...self.services.installation_manager import InstallationManager
|
|
11
|
+
from .base_handler import BaseHandler
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class UninstallHandler(BaseHandler):
|
|
15
|
+
"""Handler for the uninstall subcommand - uninstalls wl command."""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self, uv_path: str, env: dict, installation_manager: InstallationManager
|
|
19
|
+
):
|
|
20
|
+
"""
|
|
21
|
+
Initialize the uninstall handler.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
uv_path: Path to uv executable
|
|
25
|
+
env: Environment variables
|
|
26
|
+
installation_manager: Installation manager instance
|
|
27
|
+
"""
|
|
28
|
+
self._uv_path = uv_path
|
|
29
|
+
self._env = env
|
|
30
|
+
self._installation_manager = installation_manager
|
|
31
|
+
|
|
32
|
+
def execute(self) -> None:
|
|
33
|
+
"""Execute the uninstall subcommand."""
|
|
34
|
+
log_info_pair("Uninstalling wl command...", "正在卸载wl命令...")
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
log_info_pair("Step 3: Uninstalling wl command...", "步骤3: 卸载wl命令...")
|
|
38
|
+
self._installation_manager.uninstall(self._uv_path, self._env)
|
|
39
|
+
|
|
40
|
+
log_info_pair(
|
|
41
|
+
"Step 4: Uninstallation completed successfully!",
|
|
42
|
+
"步骤4: 卸载成功完成!",
|
|
43
|
+
)
|
|
44
|
+
except FileNotFoundError as e:
|
|
45
|
+
log_error_pair(f"Environment error: {e}", f"环境错误:{e}")
|
|
46
|
+
log_error_pair(
|
|
47
|
+
"Please ensure uv is installed and available in PATH",
|
|
48
|
+
"请确保uv已安装并在PATH中可用",
|
|
49
|
+
)
|
|
50
|
+
sys.exit(2)
|
|
51
|
+
except subprocess.CalledProcessError as e:
|
|
52
|
+
log_error_pair(f"Uninstallation error: {e}", f"卸载错误:{e}")
|
|
53
|
+
log_error_pair(
|
|
54
|
+
"Please check if wl is properly installed", "请检查wl是否正确安装"
|
|
55
|
+
)
|
|
56
|
+
sys.exit(3)
|
|
57
|
+
except Exception as e:
|
|
58
|
+
self.handle_error(e, 1)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handler for self update subcommand.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
from subprocess import CalledProcessError
|
|
7
|
+
|
|
8
|
+
from wl_cli.utils.logging import log_error_pair, log_info_pair
|
|
9
|
+
|
|
10
|
+
from ....utils.platform_adapter import PlatformAdapter
|
|
11
|
+
from ...self.common.config import SelfConfig
|
|
12
|
+
from ...self.services.installation_manager import InstallationManager
|
|
13
|
+
from ...self.services.local_installer import LocalInstaller
|
|
14
|
+
from ...self.services.pypi_updater import PypiUpdater
|
|
15
|
+
from ...self.services.windows_update import WindowsUpdate
|
|
16
|
+
from .base_handler import BaseHandler
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class UpdateHandler(BaseHandler):
|
|
20
|
+
"""Handler for the update subcommand - updates wl command."""
|
|
21
|
+
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
path: str | None,
|
|
25
|
+
uv_path: str,
|
|
26
|
+
env: dict,
|
|
27
|
+
installation_manager: InstallationManager,
|
|
28
|
+
config: SelfConfig,
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
Initialize the update handler.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
path: Path to local source (None for PyPI update)
|
|
35
|
+
uv_path: Path to uv executable
|
|
36
|
+
env: Environment variables
|
|
37
|
+
installation_manager: Installation manager instance
|
|
38
|
+
config: Self configuration
|
|
39
|
+
"""
|
|
40
|
+
self._path = path
|
|
41
|
+
self._uv_path = uv_path
|
|
42
|
+
self._env = env
|
|
43
|
+
self._installation_manager = installation_manager
|
|
44
|
+
self._config = config
|
|
45
|
+
|
|
46
|
+
def execute(self) -> None:
|
|
47
|
+
"""Execute the update subcommand."""
|
|
48
|
+
log_info_pair("Updating wl command...", "正在更新wl命令...")
|
|
49
|
+
|
|
50
|
+
log_info_pair(
|
|
51
|
+
f"Using configuration: {self._config.__dict__}",
|
|
52
|
+
f"使用配置: {self._config.__dict__}",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Initialize variables that need to be accessible in except blocks
|
|
56
|
+
installation_manager: InstallationManager | None = self._installation_manager
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
# Determine whether to install local or update from PyPI
|
|
60
|
+
if self._path is not None and self._path == ".":
|
|
61
|
+
# Install local code (like reinstall.bat)
|
|
62
|
+
log_info_pair(
|
|
63
|
+
"Step 3: Installing local code...", "步骤3: 安装本地代码..."
|
|
64
|
+
)
|
|
65
|
+
local_installer = LocalInstaller()
|
|
66
|
+
local_installer.install(self._uv_path, self._env)
|
|
67
|
+
else:
|
|
68
|
+
# Update from PyPI using the same installation method
|
|
69
|
+
log_info_pair("Step 3: Updating from PyPI...", "步骤3: 从PyPI更新...")
|
|
70
|
+
pypi_updater = PypiUpdater()
|
|
71
|
+
# Update cache timeout based on config
|
|
72
|
+
if hasattr(pypi_updater, "_cache_timeout"):
|
|
73
|
+
pypi_updater._cache_timeout = self._config.cache_timeout
|
|
74
|
+
pypi_updater.update(self._uv_path, self._env)
|
|
75
|
+
|
|
76
|
+
log_info_pair(
|
|
77
|
+
"Step 4: Update completed successfully!", "步骤4: 更新成功完成!"
|
|
78
|
+
)
|
|
79
|
+
except FileNotFoundError as e:
|
|
80
|
+
log_error_pair(f"Environment error: {e}", f"环境错误:{e}")
|
|
81
|
+
log_error_pair(
|
|
82
|
+
"Please ensure uv is installed and available in PATH",
|
|
83
|
+
"请确保uv已安装并在PATH中可用",
|
|
84
|
+
)
|
|
85
|
+
sys.exit(2)
|
|
86
|
+
except CalledProcessError as e:
|
|
87
|
+
log_error_pair(f"Installation error: {e}", f"安装错误:{e}")
|
|
88
|
+
log_error_pair(
|
|
89
|
+
"Please check your network connection and try again",
|
|
90
|
+
"请检查网络连接并重试",
|
|
91
|
+
)
|
|
92
|
+
sys.exit(3)
|
|
93
|
+
except Exception as e:
|
|
94
|
+
if (
|
|
95
|
+
installation_manager
|
|
96
|
+
and PlatformAdapter.is_windows()
|
|
97
|
+
and installation_manager.is_file_in_use_error(str(e))
|
|
98
|
+
):
|
|
99
|
+
windows_update = WindowsUpdate()
|
|
100
|
+
windows_update.handle_access_error(self._uv_path or "")
|
|
101
|
+
else:
|
|
102
|
+
self.handle_error(e, 1)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handler for self version subcommand.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from wl_cli import __version__
|
|
6
|
+
from wl_cli.utils.logging import log_info_pair
|
|
7
|
+
|
|
8
|
+
from .base_handler import BaseHandler
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class VersionHandler(BaseHandler):
|
|
12
|
+
"""Handler for the version subcommand - shows current version."""
|
|
13
|
+
|
|
14
|
+
def execute(self) -> None:
|
|
15
|
+
"""Execute the version subcommand."""
|
|
16
|
+
log_info_pair(f"wl version: {__version__}", f"wl 版本: {__version__}")
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Self update command.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
from wl_cli.utils.logging import log_error_pair, log_info_pair
|
|
12
|
+
|
|
13
|
+
from ...env_status import emit_check
|
|
14
|
+
from .common.capabilities import capability_names
|
|
15
|
+
from .common.config import SelfConfig
|
|
16
|
+
from .handlers.install_handler import InstallHandler
|
|
17
|
+
from .handlers.status_handler import StatusHandler
|
|
18
|
+
from .handlers.uninstall_handler import UninstallHandler
|
|
19
|
+
from .handlers.update_handler import UpdateHandler
|
|
20
|
+
from .handlers.version_handler import VersionHandler
|
|
21
|
+
from .services.installation_manager import InstallationManager
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from .handlers.base_handler import BaseHandler
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@click.group(
|
|
28
|
+
invoke_without_command=True,
|
|
29
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
30
|
+
)
|
|
31
|
+
def self_group() -> None:
|
|
32
|
+
"""Self management commands for the wl command.
|
|
33
|
+
|
|
34
|
+
Use one of the subcommands: update, version, install, uninstall, status,
|
|
35
|
+
capabilities
|
|
36
|
+
|
|
37
|
+
If no subcommand is specified, defaults to 'update'.
|
|
38
|
+
"""
|
|
39
|
+
ctx = click.get_current_context()
|
|
40
|
+
if ctx.invoked_subcommand is None:
|
|
41
|
+
_execute_update_command()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _prepare_environment() -> tuple[str, dict, InstallationManager]:
|
|
45
|
+
"""
|
|
46
|
+
Prepare environment for self commands.
|
|
47
|
+
为self命令准备环境。
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
tuple: (uv_path, env, installation_manager)
|
|
51
|
+
"""
|
|
52
|
+
log_info_pair("Step 1: Preparing environment...", "步骤1: 准备环境...")
|
|
53
|
+
|
|
54
|
+
installation_manager = InstallationManager()
|
|
55
|
+
uv_path, env = installation_manager.prepare_environment()
|
|
56
|
+
|
|
57
|
+
log_info_pair(
|
|
58
|
+
"Step 2: Determining installation method...", "步骤2: 确定安装方式..."
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return uv_path, env, installation_manager
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _execute_update_command(path: str | None = None) -> None:
|
|
65
|
+
"""Execute the update command logic."""
|
|
66
|
+
try:
|
|
67
|
+
if path:
|
|
68
|
+
if ".." in path or (os.sep + ".." in path) or path.startswith(".."):
|
|
69
|
+
raise ValueError("Path traversal detected in path argument")
|
|
70
|
+
|
|
71
|
+
config = SelfConfig.load()
|
|
72
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
73
|
+
handler = UpdateHandler(path, uv_path, env, installation_manager, config)
|
|
74
|
+
handler.execute()
|
|
75
|
+
except Exception as e:
|
|
76
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
77
|
+
sys.exit(1)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@self_group.command()
|
|
81
|
+
@click.argument("path", default=None, required=False)
|
|
82
|
+
def update(path: str | None) -> None:
|
|
83
|
+
"""Update wl command to latest version."""
|
|
84
|
+
_execute_update_command(path=path)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@self_group.command()
|
|
88
|
+
def version() -> None:
|
|
89
|
+
"""Show current version information."""
|
|
90
|
+
try:
|
|
91
|
+
handler = VersionHandler()
|
|
92
|
+
handler.execute()
|
|
93
|
+
except Exception as e:
|
|
94
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
95
|
+
sys.exit(1)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@self_group.command()
|
|
99
|
+
@click.argument("path", default=None, required=False)
|
|
100
|
+
def install(path: str | None) -> None:
|
|
101
|
+
"""Install specified version."""
|
|
102
|
+
try:
|
|
103
|
+
if path:
|
|
104
|
+
if ".." in path or (os.sep + ".." in path) or path.startswith(".."):
|
|
105
|
+
raise ValueError("Path traversal detected in path argument")
|
|
106
|
+
|
|
107
|
+
config = SelfConfig.load()
|
|
108
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
109
|
+
handler = InstallHandler(path, uv_path, env, installation_manager, config)
|
|
110
|
+
handler.execute()
|
|
111
|
+
except Exception as e:
|
|
112
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
113
|
+
sys.exit(1)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@self_group.command()
|
|
117
|
+
def uninstall() -> None:
|
|
118
|
+
"""Uninstall wl command."""
|
|
119
|
+
try:
|
|
120
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
121
|
+
handler = UninstallHandler(uv_path, env, installation_manager)
|
|
122
|
+
handler.execute()
|
|
123
|
+
except Exception as e:
|
|
124
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@self_group.command()
|
|
129
|
+
def status() -> None:
|
|
130
|
+
"""Show current status and update information."""
|
|
131
|
+
try:
|
|
132
|
+
config = SelfConfig.load()
|
|
133
|
+
handler = StatusHandler(config.cache_timeout)
|
|
134
|
+
handler.execute()
|
|
135
|
+
except Exception as e:
|
|
136
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
137
|
+
sys.exit(1)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
#: One-release deprecation window (#221): the alias keeps working, answers
|
|
141
|
+
#: with the same envelope as ``wl env check --json`` and points consumers at
|
|
142
|
+
#: the replacement. Removed after the release that ships 0.8.0.
|
|
143
|
+
CAPABILITIES_DEPRECATION = "wl self capabilities is deprecated; use wl env check --json"
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@self_group.command()
|
|
147
|
+
@click.option("--json", "as_json", is_flag=True, help="Output JSON format")
|
|
148
|
+
def capabilities(as_json: bool) -> None:
|
|
149
|
+
"""Deprecated alias for ``wl env check`` (#221, #270).
|
|
150
|
+
|
|
151
|
+
Capabilities are stable dotted names (``test.clean_cache``), not CLI flag
|
|
152
|
+
literals; consumers probe this instead of grepping ``--help``. Read-only:
|
|
153
|
+
``--json`` emits the ``wl env check`` envelope (one line on stdout, never a
|
|
154
|
+
``.wl`` write), while the deprecation notice goes to stderr. Without
|
|
155
|
+
``--json`` the capability names are printed one per line.
|
|
156
|
+
"""
|
|
157
|
+
click.echo(CAPABILITIES_DEPRECATION, err=True)
|
|
158
|
+
if as_json:
|
|
159
|
+
raise SystemExit(emit_check())
|
|
160
|
+
for name in capability_names():
|
|
161
|
+
click.echo(name)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def self_command() -> click.Group:
|
|
165
|
+
"""Return the self Click group for registration."""
|
|
166
|
+
return self_group
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class SelfCommand:
|
|
170
|
+
"""Command for self-management of the wl command (legacy).
|
|
171
|
+
|
|
172
|
+
Subcommands:
|
|
173
|
+
update - Update wl command to latest version
|
|
174
|
+
version - Show current version information
|
|
175
|
+
install - Install specified version
|
|
176
|
+
uninstall - Uninstall wl command
|
|
177
|
+
status - Show current status and update information
|
|
178
|
+
capabilities - Show the capabilities this wl build supports
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
@property
|
|
182
|
+
def name(self) -> str:
|
|
183
|
+
return "self"
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def help(self) -> str:
|
|
187
|
+
return (
|
|
188
|
+
"Self management commands "
|
|
189
|
+
"(update, version, install, uninstall, status, capabilities)"
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
def execute(self, subcommand: str = "update", path: str | None = None) -> None:
|
|
193
|
+
"""
|
|
194
|
+
Self management commands for the wl command.
|
|
195
|
+
wl命令的自我管理命令。
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
subcommand: The subcommand to execute. Defaults to "update".
|
|
199
|
+
path: Path to local source or version specification.
|
|
200
|
+
"""
|
|
201
|
+
valid_subcommands = ["update", "version", "install", "uninstall", "status"]
|
|
202
|
+
if subcommand not in valid_subcommands:
|
|
203
|
+
raise ValueError(f"Invalid subcommand: {subcommand}")
|
|
204
|
+
|
|
205
|
+
if path:
|
|
206
|
+
if ".." in path or (os.sep + ".." in path) or path.startswith(".."):
|
|
207
|
+
raise ValueError("Path traversal detected in path argument")
|
|
208
|
+
|
|
209
|
+
try:
|
|
210
|
+
config = SelfConfig.load()
|
|
211
|
+
|
|
212
|
+
handler: BaseHandler
|
|
213
|
+
if subcommand == "version":
|
|
214
|
+
handler = VersionHandler()
|
|
215
|
+
handler.execute()
|
|
216
|
+
elif subcommand == "update":
|
|
217
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
218
|
+
handler = UpdateHandler(
|
|
219
|
+
path, uv_path, env, installation_manager, config
|
|
220
|
+
)
|
|
221
|
+
handler.execute()
|
|
222
|
+
elif subcommand == "install":
|
|
223
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
224
|
+
handler = InstallHandler(
|
|
225
|
+
path, uv_path, env, installation_manager, config
|
|
226
|
+
)
|
|
227
|
+
handler.execute()
|
|
228
|
+
elif subcommand == "uninstall":
|
|
229
|
+
uv_path, env, installation_manager = _prepare_environment()
|
|
230
|
+
handler = UninstallHandler(uv_path, env, installation_manager)
|
|
231
|
+
handler.execute()
|
|
232
|
+
elif subcommand == "status":
|
|
233
|
+
handler = StatusHandler(config.cache_timeout)
|
|
234
|
+
handler.execute()
|
|
235
|
+
except Exception as e:
|
|
236
|
+
log_error_pair(f"Unexpected error: {e}", f"意外错误:{e}")
|
|
237
|
+
sys.exit(1)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Business services for self module.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .installation_manager import InstallationManager
|
|
6
|
+
from .local_installer import LocalInstaller
|
|
7
|
+
from .pypi_updater import PypiUpdater
|
|
8
|
+
from .windows_update import WindowsUpdate
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"InstallationManager",
|
|
12
|
+
"LocalInstaller",
|
|
13
|
+
"PypiUpdater",
|
|
14
|
+
"WindowsUpdate",
|
|
15
|
+
]
|