summaryrefslogtreecommitdiff
path: root/tools/manifestfile.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-09-30 15:33:43 +1000
committerJim Mussared <jim.mussared@gmail.com>2022-09-30 17:34:03 +1000
commit282401da5c6e689e63af7b9858cf9b0d23a24b2b (patch)
tree68539f3d492a7b0c5890cce861d6f757d7e1c814 /tools/manifestfile.py
parent924a3e03ec167c4417d89b531794c75ce5a631a3 (diff)
tools/manifestfile.py: Replace recursive glob with os.walk.
Recursive glob isn't supported before Python 3.5. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tools/manifestfile.py')
-rw-r--r--tools/manifestfile.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/manifestfile.py b/tools/manifestfile.py
index f7966ccb8..fb9691d29 100644
--- a/tools/manifestfile.py
+++ b/tools/manifestfile.py
@@ -311,14 +311,14 @@ class ManifestFile:
lib_dirs = ["unix-ffi"] + lib_dirs
for lib_dir in lib_dirs:
- for manifest_path in glob.glob(
- os.path.join(
- self._path_vars["MPY_LIB_DIR"], lib_dir, "**", name, "manifest.py"
- ),
- recursive=True,
+ # Search for {lib_dir}/**/{name}/manifest.py.
+ for root, dirnames, filenames in os.walk(
+ os.path.join(self._path_vars["MPY_LIB_DIR"], lib_dir)
):
- self.include(manifest_path, **kwargs)
- return
+ if os.path.basename(root) == name and "manifest.py" in filenames:
+ self.include(root, **kwargs)
+ return
+
raise ValueError("Library not found in local micropython-lib: {}".format(name))
else:
# TODO: HTTP request to obtain URLs from manifest.json.