diff options
author | Leon Anavi <leon.anavi@konsulko.com> | 2022-11-02 21:18:00 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-07 14:32:41 +0000 |
commit | d23d41bc25b230a712636d87a19cff4273a48438 (patch) | |
tree | 3c941a46e29d67791ecaa198b47907ea8e7eb5a2 /meta/recipes-devtools | |
parent | 482c493cf681121fb041f98066a42af14145ff9e (diff) | |
download | poky-d23d41bc25b230a712636d87a19cff4273a48438.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: 8acce12c1a4cf37ac312c92d62a6ae93a349dddf)
Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/python/python3/get_module_deps3.py | 2 |
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: | |||
56 | try: | 56 | try: |
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")): |