1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
Replace deprecated pkg_resources with importlib.resources.
--- a/barectf/config_parse_common.py
+++ b/barectf/config_parse_common.py
@@ -21,7 +21,7 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-import pkg_resources
+import importlib.resources
import collections
import jsonschema # type: ignore
import os.path
@@ -126,7 +126,7 @@
# validate as well as a schema short ID.
class _SchemaValidator:
def __init__(self, subdirs: Iterable[str]):
- schemas_dir = pkg_resources.resource_filename(__name__, 'schemas')
+ schemas_dir = importlib.resources.files(__name__).joinpath('schemas')
self._store: Dict[str, str] = {}
for subdir in subdirs:
@@ -350,7 +350,7 @@
self._include_dirs = copy.copy(include_dirs)
if with_pkg_include_dir:
- self._include_dirs.append(pkg_resources.resource_filename(__name__, f'include/{major_version}'))
+ self._include_dirs.append(importlib.resources.files(__name__).joinpath(f'include/{major_version}'))
self._ignore_include_not_found = ignore_include_not_found
self._include_stack: List[str] = []
|