summaryrefslogtreecommitdiffstatshomepage
path: root/tools/manifestfile.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-07-15 23:42:51 +1000
committerJim Mussared <jim.mussared@gmail.com>2022-09-05 17:06:52 +1000
commite9a28ce312b75a4f2b3b7a8c3e38b7766cb567b3 (patch)
tree34794de3491a194a49812d6f5edb2ab5d3f278f3 /tools/manifestfile.py
parent6bd0ec7a70496dc51d8dc6c706919ef398b0346e (diff)
downloadmicropython-e9a28ce312b75a4f2b3b7a8c3e38b7766cb567b3.tar.gz
micropython-e9a28ce312b75a4f2b3b7a8c3e38b7766cb567b3.zip
tools/manifestfile.py: Allow include of directory path.
If an include path is a directory, then it implicitly grabs the manifest.py file inside that directory. This simplifies most manifest.py files. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tools/manifestfile.py')
-rw-r--r--tools/manifestfile.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/manifestfile.py b/tools/manifestfile.py
index cb155da210..bf626c22b3 100644
--- a/tools/manifestfile.py
+++ b/tools/manifestfile.py
@@ -198,13 +198,6 @@ class ManifestFile:
# TODO
pass
- def include_maybe(self, manifest_path, **kwargs):
- """
- Include the manifest file if it exists. See docs for include().
- """
- if os.path.exists(manifest_path):
- self.include(manifest_path, **kwargs)
-
def include(self, manifest_path, **kwargs):
"""
Include another manifest.
@@ -214,6 +207,9 @@ class ManifestFile:
Relative paths are resolved with respect to the current manifest file.
+ If the path is to a directory, then it implicitly includes the
+ manifest.py file inside that directory.
+
Optional kwargs can be provided which will be available to the
included script via the `options` variable.
@@ -233,6 +229,9 @@ class ManifestFile:
self.include(m)
else:
manifest_path = self._resolve_path(manifest_path)
+ # Including a directory grabs the manifest.py inside it.
+ if os.path.isdir(manifest_path):
+ manifest_path = os.path.join(manifest_path, "manifest.py")
if manifest_path in self._visited:
return
self._visited.add(manifest_path)