tools: Fall back to importlib_resources on Python 3.6
importlib.resources became part of 3.7 only. Allow using distros with 3.6 and the importlib_resources backport. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f53e973b84
commit
de65b122a2
3 changed files with 15 additions and 3 deletions
|
@ -7,7 +7,11 @@
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import glob
|
import glob
|
||||||
import importlib.resources
|
try:
|
||||||
|
import importlib.resources
|
||||||
|
except ImportError:
|
||||||
|
# for Python 3.6
|
||||||
|
import importlib_resources
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import importlib.resources
|
try:
|
||||||
|
import importlib.resources
|
||||||
|
except ImportError:
|
||||||
|
# for Python 3.6
|
||||||
|
import importlib_resources
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -7,7 +7,11 @@
|
||||||
"""See README for more information"""
|
"""See README for more information"""
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import importlib.resources
|
try:
|
||||||
|
import importlib.resources
|
||||||
|
except ImportError:
|
||||||
|
# for Python 3.6
|
||||||
|
import importlib_resources
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue