Commit e9a28ce3 authored by Jim Mussared's avatar Jim Mussared

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: default avatarJim Mussared <jim.mussared@gmail.com>
parent 6bd0ec7a
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment