8000 tools/makemanifest.py: Add support for optional board-level manifest. · micropython/micropython@b3f150f · GitHub
[go: up one dir, main page]

Skip to content

Commit b3f150f

Browse files
committed
tools/makemanifest.py: Add support for optional board-level manifest.
* Allow adding board-level frozen modules via optional board-manifest. * Example usage: include("$(BOARD_DIR)/manifest.py", optional=True)
1 parent a367529 commit b3f150f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tools/makemanifest.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,20 @@ def include(manifest, **kwargs):
6161
for m in manifest:
6262
include(m)
6363
else:
64+
options = IncludeOptions(**kwargs)
6465
manifest = convert_path(manifest)
65-
with open(manifest) as f:
66-
# Make paths relative to this manifest file while processing it.
67-
# Applies to includes and input files.
68-
prev_cwd = os.getcwd()
69-
os.chdir(os.path.dirname(manifest))
70-
exec(f.read(), globals(), {"options": IncludeOptions(**kwargs)})
71-
os.chdir(prev_cwd)
66+
try:
67+
with open(manifest) as f:
68+
# Make paths relative to this manifest file while processing it.
69+
# Applies to includes and input files.
70+
prev_cwd = os.getcwd()
71+
os.chdir(os.path.dirname(manifest))
72+
exec(f.read(), globals(), {"options": options})
73+
os.chdir(prev_cwd)
74+
except FileNotFoundError as er:
75+
# If manifest doesn't exist and is Not optional, raise error.
76+
if not options.optional:
77+
raise (er)
7278

7379

7480
def freeze(path, script=None, opt=0):

0 commit comments

Comments
 (0)
0