summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/get_module_deps3.py
diff options
context:
space:
mode:
authorLeon Anavi <leon.anavi@konsulko.com>2022-11-02 21:18:00 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-24 15:30:01 +0000
commitf9679ac9f89d371c1934ccb319eb3c3eae33d61d (patch)
tree825b16467adc35eb8eb33d16b604801e5af513a3 /meta/recipes-devtools/python/python3/get_module_deps3.py
parent0535ee1c7c94e41f15c5823662f92314b28380a2 (diff)
downloadpoky-f9679ac9f89d371c1934ccb319eb3c3eae33d61d.tar.gz
get_module_deps3.py: Check attribute '__file__'
Check if the module object has attribute '__file__' to fix and avoid errors like: AttributeError: module '_abc' has no attribute '__file__'. Did you mean: '__name__'? (From OE-Core rev: 1684457df9fb7029a276df4438c8fc4a17e3e1e9) Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 8acce12c1a4cf37ac312c92d62a6ae93a349dddf) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3/get_module_deps3.py')
-rw-r--r--meta/recipes-devtools/python/python3/get_module_deps3.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/recipes-devtools/python/python3/get_module_deps3.py b/meta/recipes-devtools/python/python3/get_module_deps3.py
index 1f4c982aed..0ca687d2eb 100644
--- a/meta/recipes-devtools/python/python3/get_module_deps3.py
+++ b/meta/recipes-devtools/python/python3/get_module_deps3.py
@@ -56,7 +56,7 @@ if debug == True:
56try: 56try:
57 m = importlib.import_module(current_module) 57 m = importlib.import_module(current_module)
58 # handle python packages which may not include all modules in the __init__ 58 # handle python packages which may not include all modules in the __init__
59 if os.path.basename(m.__file__) == "__init__.py": 59 if hasattr(m, '__file__') and os.path.basename(m.__file__) == "__init__.py":
60 modulepath = os.path.dirname(m.__file__) 60 modulepath = os.path.dirname(m.__file__)
61 for i in os.listdir(modulepath): 61 for i in os.listdir(modulepath):
62 if i.startswith("_") or not(i.endswith(".py")): 62 if i.startswith("_") or not(i.endswith(".py")):