File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 4848import importlib .util
4949import inspect
5050import itertools
51+ import logging
5152import os
5253import sys
5354from typing import Optional , TYPE_CHECKING , TypedDict
6162 from types import ModuleType
6263
6364
65+ LOGGER = logging .getLogger (__name__ )
66+
67+
6468class PluginMetaDescription (TypedDict ):
6569 """Meta description of a plugin, as a dictionary.
6670
@@ -623,11 +627,17 @@ def get_version(self) -> Optional[str]:
623627 and hasattr (self .entry_point , "dist" )
624628 and hasattr (self .entry_point .dist , "name" )
625629 ):
630+ dist_name = self .entry_point .dist .name
626631 try :
627- version = importlib .metadata .version (self .entry_point .dist .name )
632+ version = importlib .metadata .version (dist_name )
633+ except (ValueError , importlib .metadata .PackageNotFoundError ):
634+ LOGGER .warning ("Cannot determine version of %r" , dist_name )
628635 except Exception :
629- # fine, just give up
630- pass
636+ LOGGER .warning (
637+ "Unexpected error occurred while checking the version of %r" ,
638+ dist_name ,
639+ exc_info = True ,
640+ )
631641
632642 return version
633643
You can’t perform that action at this time.
0 commit comments