feat: Install Python plugin wheels with uv (#17281)

* feat: initial migration to let UV install plugins for .whls

* fix: clang-tidy

* Simplify plugin wheel loading through uv

* fix: use legacy loader for plugins loaded with legacy method

* fix: use same unzip name as old one

* fix: keep legacy plugins on the same path

* fix: unit tests

* fix: allow epoch versions in wheel filenames

* fix: clang-tidy

* fix: pass Unicode paths to uv on Windows

* fix: cleanup

* fix: support Windows long paths when installing wheel plugins

* fix: recognize uppercase .whl extensions in plugin discovery and dependencies

* fix: keep plain import paths for short namespace and compiled packages

* refactor: fold duplicate wheel import and cache migration branches

* fix: treat an absent package directory as a single-module import

* fix: windows long path deletion (#17703)

* fix: handle long Windows plugin cleanup paths

* fix: warn when plugin deletion removes no files
This commit is contained in:
Ian Chua authored and GitHub committed 2026-11-20 14:51:42 +08:00
1 parent 9d6ba7eae2
commit 0c62aa085e
13 files changed
+2995 -300

No files matched your search

+8 -9
View File
@@ -1735,29 +1735,28 @@ void PluginsDialog::reload_local_plugin(const std::string& plugin_key, bool clea
[plugin_key, was_loaded, clear_cache]() -> std::pair<bool, std::string> {
PluginManager& manager = PluginManager::instance();
boost::filesystem::path cache_dir;
boost::filesystem::path plugin_root;
if (clear_cache) {
PluginDescriptor descriptor;
if (!manager.try_get_plugin_descriptor(plugin_key, descriptor))
return {false, _u8L("Plugin not found.")};
boost::filesystem::path resolved_root;
std::string resolve_error;
std::string resolve_error;
if (!resolve_allowed_plugin_root(descriptor, {get_orca_plugins_dir()},
_u8L("Refusing to clear a plugin cache outside the local plugin directory."),
resolved_root, resolve_error))
plugin_root, resolve_error))
return {false, resolve_error};
cache_dir = resolved_root / "__whl_extracted__";
}
if (!manager.unload_plugin(plugin_key))
return {false, _u8L("Failed to unload plugin.")};
if (clear_cache) {
boost::system::error_code ec;
boost::filesystem::remove_all(cache_dir, ec);
if (ec)
return {false, GUI::format(_u8L("Failed to clear plugin cache: %1%"), ec.message())};
// __whl_extracted__ holds both dependency extractions and the uv-installed
// entry wheel. The stored wheel and plugin data are left untouched.
std::string cache_error;
if (!plugin_wheel_install::delete_install_cache(plugin_root, cache_error))
return {false, cache_error};
}
manager.load_plugin(plugin_key, false);