20
20
21
21
if sys .version_info >= (3 , 10 ):
22
22
import importlib .metadata as importlib_metadata
23
- import importlib .resources as importlib_resources
24
23
else :
25
24
import importlib_metadata
26
- import importlib_resources
27
25
28
26
29
27
__version__ = '2.1.1-8'
@@ -54,9 +52,10 @@ def get_executable() -> pathlib.Path:
54
52
else :
55
53
raise NotImplementedError
56
54
57
- executable = pathlib .Path (importlib_resources .files ('pkgconf' ) / '.bin' / executable_name )
58
- if executable .exists ():
59
- return executable
55
+ for path in __path__ :
56
+ executable = pathlib .Path (path ) / '.bin' / executable_name
57
+ if executable .exists ():
58
+ return executable
60
59
61
60
warnings .warn ('Bundled pkgconf not found, using the system executable' , stacklevel = 2 )
62
61
executable = _get_system_executable ()
@@ -69,9 +68,10 @@ def get_executable() -> pathlib.Path:
69
68
70
69
def _get_module_paths (name : str ) -> Sequence [str ]:
71
70
module = importlib .import_module (name )
72
- if 'NamespacePath' in module .__path__ .__class__ .__name__ :
71
+ if isinstance ( module . __path__ , list ) or 'NamespacePath' in module .__path__ .__class__ .__name__ :
73
72
return list (module .__path__ )
74
- return [os .fspath (importlib_resources .files (name ))]
73
+ assert isinstance (module .__path__ , str ), module .__path__
74
+ return [module .__path__ ]
75
75
76
76
77
77
def get_pkg_config_path () -> Sequence [str ]:
0 commit comments