You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
#! /usr/bin/env python3
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def run_inner(args):
|
|
print("Running `{}`...".format(" ".join(args)))
|
|
ret = subprocess.call(args) == 0
|
|
print("")
|
|
return ret
|
|
|
|
|
|
def run(mcu, cargo_cmd):
|
|
if mcu == "":
|
|
return run_inner(cargo_cmd)
|
|
else:
|
|
return run_inner(cargo_cmd + ["--examples", "--features={}".format(mcu)])
|
|
|
|
|
|
def main():
|
|
cargo_meta = json.loads(
|
|
subprocess.check_output("cargo metadata --no-deps --format-version=1",
|
|
shell=True,
|
|
universal_newlines=True)
|
|
)
|
|
|
|
crate_info = cargo_meta["packages"][0]
|
|
|
|
features = [""] + ["{} rt".format(x)
|
|
for x in crate_info["features"].keys()
|
|
if x != "device-selected" and x != "rt"]
|
|
|
|
if 'size_check' in sys.argv:
|
|
cargo_cmd = ['cargo', 'build', '--release']
|
|
else:
|
|
cargo_cmd = ['cargo', 'check']
|
|
|
|
if not all(map(lambda f: run(f, cargo_cmd),
|
|
features)):
|
|
sys.exit(-1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|