File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import atexit
18
18
import ctypes .util
19
- import importlib .resources
20
19
import functools
21
20
import platform
22
21
import sys
23
22
from typing import (Any , Optional , TYPE_CHECKING )
24
23
24
+ # importlib.resources isn't available before Python 3.7, so if importing it
25
+ # fails we import the backport.
26
+ try :
27
+ from importlib import resources
28
+ except ImportError :
29
+ import importlib_resources as resources
30
+
25
31
from ._version import version as __version__
26
32
27
33
if TYPE_CHECKING :
42
48
@functools .lru_cache ()
43
49
def get_library_path () -> Optional ["Path" ]:
44
50
"""@brief Returns the path to included library, if there is one."""
45
- if importlib . resources .is_resource (__name__ , _LIBRARY_NAME ):
46
- path_resource = importlib . resources .path (__name__ , _LIBRARY_NAME )
51
+ if resources .is_resource (__name__ , _LIBRARY_NAME ):
52
+ path_resource = resources .path (__name__ , _LIBRARY_NAME )
47
53
path = path_resource .__enter__ ()
48
54
49
55
@atexit .register
You can’t perform that action at this time.
0 commit comments