core/tools/build

70 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-08-31 16:00:36 +02:00
#!/usr/bin/env python3
2023-08-31 16:00:36 +02:00
import os as _os
import shutil as _shutil
import argparse as _argparse
2023-08-31 16:00:36 +02:00
def file_copy(
path_from,
path_to
):
_shutil.copyfile(path_from, path_to)
2023-08-31 16:00:36 +02:00
def file_remove(
path
):
_os.remove(path)
2023-08-03 08:34:33 +02:00
2023-08-31 16:00:36 +02:00
def shell_execute(
command
):
_os.system(command)
def main(
):
## args
argument_parser = _argparse.ArgumentParser()
argument_parser.add_argument(
"-t",
"--include-tests",
action = "store_true"
)
args = argument_parser.parse_args()
## consts
path_prj_core_from = "tools/heimdall-core.prj.json"
path_prj_core_to = "heimdall-core.prj.json"
path_prj_app_from = "tools/heimdall-app.prj.json"
path_prj_app_to = "heimdall-app.prj.json"
path_prj_test_from = "tools/heimdall-test.prj.json"
path_prj_test_to = "heimdall-test.prj.json"
## exec
file_copy(path_prj_core_from, path_prj_core_to)
file_copy(path_prj_app_from, path_prj_app_to)
file_copy(path_prj_test_from, path_prj_test_to)
shell_execute("tools/koralle --execute %s" % path_prj_app_to)
2023-08-31 16:00:36 +02:00
shell_execute("chmod +r build/heimdall")
if (not args.include_tests):
pass
else:
shell_execute("koralle --execute %s" % path_prj_test_to)
file_remove(path_prj_test_to)
file_remove(path_prj_app_to)
file_remove(path_prj_core_to)
main()