Skip to content

Commit 911c7fb

Browse files
committed
custom file name for Project Dependencies header file
1 parent 8b9fc96 commit 911c7fb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

build_platform.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@
3232
# optional wippersnapper argument to generate a dependencies header file
3333
PRINT_DEPENDENCIES_AS_HEADER = False
3434
INCLUDE_PRINT_DEPENDENCIES_HEADER = False
35+
PRINT_DEPENDENCIES_AS_HEADER_FILENAME = None
3536
if "--include_print_dependencies_header" in sys.argv:
37+
# check argument not null and folder path exists
38+
PRINT_DEPENDENCIES_AS_HEADER_FILENAME = sys.argv[sys.argv.index("--include_print_dependencies_header") + 1] if len(sys.argv) > sys.argv.index("--include_print_dependencies_header") + 1 else None
39+
if PRINT_DEPENDENCIES_AS_HEADER_FILENAME is None or not os.path.exists(PRINT_DEPENDENCIES_AS_HEADER_FILENAME):
40+
raise AttributeError("Header file path not found or not provided to --include_print_dependencies_header argument")
3641
INCLUDE_PRINT_DEPENDENCIES_HEADER = True
42+
sys.argv.pop(sys.argv.index("--include_print_dependencies_header") + 1)
3743
sys.argv.remove("--include_print_dependencies_header")
3844

3945
# add user bin to path!
@@ -497,7 +503,7 @@ def test_examples_in_folder(platform, folderpath):
497503
if PRINT_DEPENDENCIES_AS_HEADER:
498504
# Extract dependencies and write to header for the first successful example
499505
dependencies = extract_dependencies(out.decode("utf-8") + err.decode("utf-8"))
500-
write_dependencies_to_header(dependencies, os.path.join(BUILD_DIR, 'print_dependencies.h'))
506+
write_dependencies_to_header(dependencies, PRINT_DEPENDENCIES_AS_HEADER_FILENAME)
501507
elif os.path.exists(gen_file_name):
502508
if ALL_PLATFORMS[platform][1] is None:
503509
ColorPrint.print_info("Platform does not support UF2 files, skipping...")

0 commit comments

Comments
 (0)