plugin add modelscope source

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/12306018
This commit is contained in:
zhangzhicheng.zzc
2023-04-12 20:38:13 +08:00
committed by hemu
parent 7b5f350f68
commit e27b84fe37

View File

@@ -635,6 +635,10 @@ class PluginsManager(object):
Returns:
"""
if package.split('.')[-1] == 'whl':
return False, ''
from pip._internal.utils.packaging import get_requirement, specifiers
req = get_requirement(package)
@@ -675,6 +679,11 @@ class PluginsManager(object):
"""
from pip._internal.commands import create_command
importlib.reload(pkg_resources)
if command == 'install':
command_args.append('-f')
command_args.append(
'https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html'
)
command = create_command(command)
options, args = command.parse_args(command_args)