Skip to content

Commit f95039b

Browse files
committed
Add --boards-local-txt argument
1 parent ea51e4a commit f95039b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

build_platform.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@
2929
sys.argv.pop(sys.argv.index("--build_timeout") + 1)
3030
sys.argv.remove("--build_timeout")
3131

32+
# optional --boards-local-txt option to copy boards.local.txt
33+
# to the appropriate package folder after installing the platform
34+
COPY_BOARDS_LOCAL_TXT = False
35+
boards_local_txt = None
36+
if "--boards-local-txt" in sys.argv:
37+
COPY_BOARDS_LOCAL_TXT = True
38+
if sys.argv.index("--boards-local-txt") + 1 >= len(sys.argv):
39+
# check if in cwd
40+
if os.path.exists("boards.local.txt"):
41+
boards_local_txt = "boards.local.txt"
42+
else:
43+
sys.stderr.write("Error: --boards-local-txt option requires a path to boards.local.txt file\n")
44+
sys.exit(1)
45+
else:
46+
# get the boards.local.txt file from the command line
47+
if not os.path.exists(sys.argv[sys.argv.index("--boards-local-txt") + 1]):
48+
sys.stderr.write("Error: boards.local.txt file does not exist\n")
49+
sys.exit(1)
50+
boards_local_txt = sys.argv[sys.argv.index("--boards-local-txt") + 1]
51+
sys.argv.pop(sys.argv.index("--boards-local-txt") + 1)
52+
sys.argv.remove("--boards-local-txt")
53+
3254
# add user bin to path!
3355
BUILD_DIR = ''
3456
# add user bin to path!

0 commit comments

Comments
 (0)