Unable to install plugins through web UI using custom registry and/or Python wheel files.

Fixes #11460
This commit is contained in:
Matthias Mair 2026-04-02 00:26:28 +02:00
parent c8bcb924ca
commit 1f8f7fc163
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
1 changed files with 23 additions and 14 deletions

View File

@ -245,9 +245,7 @@ def install_plugin(url=None, packagename=None, user=None, version=None):
logger.info('install_plugin: %s, %s', url, packagename)
# build up the command
install_name = ['install', '-U', '--disable-pip-version-check']
full_pkg = ''
full_pkg = None
if url:
# use custom registration / VCS
@ -255,27 +253,34 @@ def install_plugin(url=None, packagename=None, user=None, version=None):
identifier in url for identifier in ['git+https', 'hg+https', 'svn+svn']
]:
# using a VCS provider
full_pkg = f'{packagename}@{url}' if packagename else url
elif url:
install_name.append('-i')
full_pkg = url
elif packagename:
full_pkg = packagename
full_pkg = [f'{packagename}@{url}' if packagename else url]
elif url and packagename:
full_pkg = [packagename, '-i', url]
else:
full_pkg = ['-i', url]
elif packagename:
# use pypi
full_pkg = packagename
full_pkg = [packagename]
if version:
full_pkg = f'{full_pkg}=={version}'
full_pkg = [f'{packagename}=={version}']
install_name.append(full_pkg)
if not full_pkg:
raise ValidationError(
_('No package name or URL could be generated with the inputs provided')
)
ret = {}
# Execute installation via pip
try:
result = pip_command(*install_name)
result = pip_command(*[
'install',
'-U',
'--disable-pip-version-check',
*full_pkg,
])
ret['result'] = ret['success'] = _('Installed plugin successfully')
ret['output'] = str(result, 'utf-8')
@ -292,7 +297,11 @@ def install_plugin(url=None, packagename=None, user=None, version=None):
if version := ret.get('version'):
# Save plugin to plugins file
update_plugins_file(packagename, full_package=full_pkg, version=version)
update_plugins_file(
packagename,
full_package=' '.join(full_pkg) if isinstance(full_pkg, list) else None,
version=version,
)
# Reload the plugin registry, to discover the new plugin
from plugin.registry import registry