from collections import OrderedDict
import glob
try:
- import importlib.resources
+ import importlib.resources as importlib_resources
except ImportError: # pragma: no cover
# for Python 3.6
import importlib_resources
import os
-import pkg_resources
import re
import sys
msg = ''
return tag, msg
- my_data = pkg_resources.resource_string(__name__, 'missing-blob-help')
+ my_data = importlib_resources.files(__package__).joinpath('missing-blob-help').read_bytes()
re_tag = re.compile(r"^([-\.a-z0-9]+):$")
result = {}
tag = None
Returns:
Set of paths to entry class filenames
"""
- glob_list = pkg_resources.resource_listdir(__name__, 'etype')
- glob_list = [fname for fname in glob_list if fname.endswith('.py')]
+ entries = importlib_resources.files(__package__).joinpath('etype')
+ glob_list = [entry.name for entry in entries.iterdir()
+ if entry.name.endswith('.py') and entry.is_file()]
return set([os.path.splitext(os.path.basename(item))[0]
for item in glob_list
if include_testing or '_testing' not in item])
global state
if args.full_help:
- with importlib.resources.path('binman', 'README.rst') as readme:
+ with importlib_resources.path('binman', 'README.rst') as readme:
tools.print_full_help(str(readme))
return 0