Fix optional priority packaged always compare lower case package name

This commit is contained in:
allegroai 2022-06-16 23:18:31 +03:00
parent d9856d5de5
commit f66e42ddb1

View File

@ -16,10 +16,10 @@ class PriorityPackageRequirement(SimpleSubstitution):
# check if we need to replace the packages:
priority_packages = self.config.get('agent.package_manager.priority_packages', None)
if priority_packages:
self.__class__.name = priority_packages
self.__class__.name = [p.lower() for p in priority_packages]
priority_optional_packages = self.config.get('agent.package_manager.priority_optional_packages', None)
if priority_optional_packages:
self.__class__.optional_package_names = priority_optional_packages
self.__class__.optional_package_names = [p.lower() for p in priority_optional_packages]
def match(self, req):
# match both Cython & cython
@ -32,7 +32,7 @@ class PriorityPackageRequirement(SimpleSubstitution):
"""
self._replaced_packages[req.name] = req.line
if req.name in self.optional_package_names:
if req.name.lower() in self.optional_package_names:
# noinspection PyBroadException
try:
if PackageManager.out_of_scope_install_package(str(req)):