29 lines
636 B
Python
29 lines
636 B
Python
import subprocess
|
|
import yaml
|
|
import os
|
|
import sys
|
|
|
|
def run(cmd: str) -> int:
|
|
print(f"$ {cmd}", flush=True)
|
|
p = subprocess.run(cmd, shell=True)
|
|
return p.returncode
|
|
|
|
def main():
|
|
cfg_path = "porting/CONFIG.yml"
|
|
if not os.path.exists(cfg_path):
|
|
cfg_path = "porting/CONFIG.example.yml"
|
|
with open(cfg_path, "r", encoding="utf-8") as f:
|
|
cfg = yaml.safe_load(f)
|
|
|
|
rc = 0
|
|
for key in ("build_cmd", "clippy_cmd", "test_cmd"):
|
|
cmd = cfg["compile"].get(key)
|
|
if cmd:
|
|
rc = run(cmd)
|
|
if rc != 0:
|
|
sys.exit(rc)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|