6 from builtins
import NotADirectoryError
20 "INTERNAL_MODULE_MULTI": "YES",
26 "INTERNAL_MODULE_MULTI": "YES",
37 return datetime
.datetime
.now().strftime("%y%m%d")
40 def build(board
, translation
, srcdir
):
41 cmake_options
= " ".join(["-D%s=%s" % (key
, value
) for key
, value
in boards
[board
].items()])
43 if not os
.path
.exists("output"):
45 path
= tempfile
.mkdtemp()
47 command
= "cmake %s -DTRANSLATIONS=%s -DJUMPER_RELEASE=YES %s" % (cmake_options
, translation
, srcdir
)
50 os
.system("make firmware -j6")
54 suffix
= "" if index
== 0 else "_%d" % index
55 filename
= "output/firmware_%s_%s_%s%s.bin" % (board
.lower(), translation
.lower(), timestamp(), suffix
)
56 if not os
.path
.exists(filename
):
57 shutil
.copy("%s/firmware.bin" % path
, filename
)
64 if os
.path
.isdir(string
):
67 raise NotADirectoryError(string
)
71 parser
= argparse
.ArgumentParser(description
="Build JumperRC firmware")
72 parser
.add_argument("-b", "--boards", action
="append", help="Destination boards", required
=True)
73 parser
.add_argument("-t", "--translations", action
="append", help="Translations", required
=True)
74 parser
.add_argument("srcdir", type=dir_path
)
76 args
= parser
.parse_args()
78 for board
in (boards
.keys() if "ALL" in args
.boards
else args
.boards
):
79 for translation
in (translations
if "ALL" in args
.translations
else args
.translations
):
80 build(board
, translation
, args
.srcdir
)
83 if __name__
== "__main__":