|
4 | 4 | import inspect |
5 | 5 | import datetime |
6 | 6 | import math |
| 7 | +import importlib.resources |
7 | 8 | from contextlib import contextmanager |
8 | | -from typing import TYPE_CHECKING, Callable |
| 9 | +from importlib.metadata import distribution |
9 | 10 |
|
10 | | -import pkg_resources |
| 11 | +from typing import TYPE_CHECKING, Callable |
11 | 12 | from enum import Enum as _Enum |
12 | 13 | from functools import wraps, partial |
13 | 14 | from operator import attrgetter |
@@ -112,20 +113,18 @@ def resource_filename(path): |
112 | 113 | """ |
113 | 114 | Return the resource filename path relative to the Orange package. |
114 | 115 | """ |
115 | | - return pkg_resources.resource_filename("Orange", path) |
| 116 | + path = importlib.resources.files("Orange").joinpath(path) |
| 117 | + return str(path) |
116 | 118 |
|
117 | 119 |
|
118 | 120 | def get_entry_point(dist, group, name): |
119 | 121 | """ |
120 | 122 | Load and return the entry point from the distribution. |
121 | | -
|
122 | | - Unlike `pkg_resources.load_entry_point`, this function does not check |
123 | | - for requirements. Calling this function is preferred because of developers |
124 | | - who experiment with different versions and have inconsistent configurations. |
125 | 123 | """ |
126 | | - dist = pkg_resources.get_distribution(dist) |
127 | | - ep = dist.get_entry_info(group, name) |
128 | | - return ep.resolve() |
| 124 | + dist = distribution(dist) |
| 125 | + eps = dist.entry_points.select(group=group, name=name) |
| 126 | + ep = next(iter(eps)) |
| 127 | + return ep.load() |
129 | 128 |
|
130 | 129 |
|
131 | 130 | def deprecated(obj): |
|
0 commit comments