| 30 | return fn(*args) |
| 31 | |
| 32 | def get_api_spec(spec_file, api_name): |
| 33 | with open(spec_file, "r") as fd: |
| 34 | d = json.load(fd) |
| 35 | if d["schema"] == "vitis_libraries_api_list_schema-1.0": |
| 36 | x = None |
| 37 | for t in d["api_list"]: |
| 38 | if t["api_name"] == api_name: |
| 39 | x = t |
| 40 | break |
| 41 | if not x: |
| 42 | print(f"ERROR: {api_name} not in {spec_file}") |
| 43 | return None |
| 44 | if "spec" in x: |
| 45 | return x["spec"] |
| 46 | elif "spec_file" in x: |
| 47 | with open(os.path.join(os.path.dirname(spec_file), x["spec_file"]), "r") as fdx: |
| 48 | dx = json.load(fdx) |
| 49 | d = dx |
| 50 | else: |
| 51 | print(f"ERROR: ill formated spec file {spec_file}") |
| 52 | return None |
| 53 | if d["schema"] == "vitis_library_api_spec_schema-1.0": |
| 54 | if d["api_name"] == api_name: |
| 55 | return d |
| 56 | else: |
| 57 | print(f"ERROR: {spec_file} is not for {api_name}") |
| 58 | return None |
| 59 | |
| 60 | def get_params(param_file, param_name): |
| 61 | with open(param_file, "r") as fd: |