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-24 15:30:06 +0000 |
| commit | 1cdb6d447c662a255d1cb5ad0321652f4d95f7ec (patch) | |
| tree | afa9a8dd1ca2b314e5fdf5e35a54a987431444b5 | |
| parent | a86656290b7a2ef7165e6602f15068edeeafed7d (diff) | |
| download | poky-1cdb6d447c662a255d1cb5ad0321652f4d95f7ec.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: ede7452e6dcb202952b85b76eecbd2e1760b11e9)
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>
| -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")): |
