10000 tools/manifestfile.py: Allow include of directory path. · micropython/micropython@1295eec · GitHub
[go: up one dir, main page]

Skip to content

Commit 1295eec

Browse files
committed
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>
1 parent c3dc498 commit 1295eec

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/manifestfile.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,6 @@ def metadata(self, description=None, version=None):
200200
# TODO
201201
pass
202202

203-
def include_maybe(self, manifest_path, **kwargs):
204-
"""
205-
Include the manifest file if it exists. See docs for include().
206-
"""
207-
if os.path.exists(manifest_path):
208-
self.include(manifest_path, **kwargs)
209-
210203
def include(self, manifest_path, **kwargs):
211204
"""
212205
Include another manifest.
@@ -216,6 +209,9 @@ def include(self, manifest_path, **kwargs):
216209
217210
Relative paths are resolved with respect to the current manifest file.
218211
212+
If the path is to a directory, then it implicitly includes the
213+
manifest.py file inside that directory.
214+
219215
Optional kwargs can be provided which will be available to the
220216
included script via the `options` variable.
221217
@@ -235,6 +231,9 @@ def include(self, manifest_path, **kwargs):
235231
self.include(m)
236232
else:
237233
manifest_path = self._resolve_path(manifest_path)
234+
# Including a directory grabs the manifest.py inside it.
235+
if os.path.isdir(manifest_path):
236+
manifest_path = os.path.join(manifest_path, "manifest.py")
238237
if manifest_path in self._visited:
239238
return
240239
self._visited.add(manifest_path)

0 commit comments

Comments
 (0)
0