fix: using latest plugin as the dep of DSL under 0.1.15

This commit is contained in:
Yeuoly
2025-02-08 14:53:43 +08:00
parent 3e9c3d0bb7
commit 8d5a8f0153
2 changed files with 44 additions and 8 deletions

View File

@ -1,3 +1,4 @@
from core.helper import marketplace
from core.plugin.entities.plugin import GenericProviderID, PluginDependency, PluginInstallationSource
from core.plugin.manager.plugin import PluginInstallationManager
@ -98,3 +99,18 @@ class DependenciesAnalysisService:
raise ValueError(f"Unknown plugin source: {plugin.source}")
return result
@classmethod
def generate_latest_dependencies(cls, dependencies: list[str]) -> list[PluginDependency]:
"""
Generate the latest version of dependencies
"""
dependencies = list(set(dependencies))
deps = marketplace.batch_fetch_plugin_manifests(dependencies)
return [
PluginDependency(
type=PluginDependency.Type.Marketplace,
value=PluginDependency.Marketplace(marketplace_plugin_unique_identifier=dep.latest_package_identifier),
)
for dep in deps
]