summaryrefslogtreecommitdiff
path: root/tools/binman/control.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-08-29 20:36:14 +0300
committerSimon Glass <sjg@chromium.org>2020-09-22 21:50:43 +0300
commit9fbfaba0a707eb4af2792b966a4f296f7778404f (patch)
treeaf3cb662e419fee019215e547dcf22340c05473c /tools/binman/control.py
parentfe05701b058c2944c288b60f4839d9b552acf059 (diff)
downloadu-boot-9fbfaba0a707eb4af2792b966a4f296f7778404f.tar.xz
binman: Use pkg_resources to find resources
At present we look for resources based on the path of the Python module that wants them. Instead we should use Python's pkg_resources feature which is designed for this purpose. Update binman to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/control.py')
-rw-r--r--tools/binman/control.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 60e89d3776..3b52326641 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -8,6 +8,8 @@
from collections import OrderedDict
import glob
import os
+import pkg_resources
+
import sys
from patman import tools
@@ -58,8 +60,8 @@ def GetEntryModules(include_testing=True):
Returns:
Set of paths to entry class filenames
"""
- our_path = os.path.dirname(os.path.realpath(__file__))
- glob_list = glob.glob(os.path.join(our_path, 'etype/*.py'))
+ glob_list = pkg_resources.resource_listdir(__name__, 'etype')
+ glob_list = [fname for fname in glob_list if fname.endswith('.py')]
return set([os.path.splitext(os.path.basename(item))[0]
for item in glob_list
if include_testing or '_testing' not in item])