|
| 1 | +from urllib.request import urlopen |
| 2 | +import json |
| 3 | +import sys |
| 4 | +import os |
| 5 | +import re |
| 6 | + |
| 7 | + |
| 8 | +def get_latest_release(repo): |
| 9 | + releases = urlopen("https://api.github.com/repos/" + repo + "/releases").read() |
| 10 | + return json.loads(releases)[0] |
| 11 | + |
| 12 | + |
| 13 | +def uplift_linux_igfx_driver(config, platform_tag): |
| 14 | + compute_runtime = get_latest_release('intel/compute-runtime') |
| 15 | + |
| 16 | + config[platform_tag]['compute_runtime']['github_tag'] = compute_runtime['tag_name'] |
| 17 | + config[platform_tag]['compute_runtime']['version'] = compute_runtime['tag_name'] |
| 18 | + config[platform_tag]['compute_runtime']['url'] = 'https://github.com/intel/compute-runtime/releases/tag/' + compute_runtime['tag_name'] |
| 19 | + |
| 20 | + for a in compute_runtime['assets']: |
| 21 | + if a['name'].endswith('.sum'): |
| 22 | + deps = str(urlopen(a['browser_download_url']).read()) |
| 23 | + m = re.search(r"intel-igc-core_([0-9\.]*)_amd64", deps) |
| 24 | + if m is not None: |
| 25 | + ver = m.group(1) |
| 26 | + config[platform_tag]['igc']['github_tag'] = 'igc-' + ver |
| 27 | + config[platform_tag]['igc']['version'] = ver |
| 28 | + config[platform_tag]['igc']['url'] = 'https://github.com/intel/intel-graphics-compiler/releases/tag/igc-' + ver |
| 29 | + break |
| 30 | + |
| 31 | + cm = get_latest_release('intel/cm-compiler') |
| 32 | + config[platform_tag]['cm']['github_tag'] = cm['tag_name'] |
| 33 | + config[platform_tag]['cm']['version'] = cm['tag_name'].replace('cmclang-', '') |
| 34 | + config[platform_tag]['cm']['url'] = 'https://github.com/intel/cm-compiler/releases/tag/' + cm['tag_name'] |
| 35 | + |
| 36 | + return config |
| 37 | + |
| 38 | + |
| 39 | +def main(platform_tag): |
| 40 | + script = os.path.dirname(os.path.realpath(__file__)) |
| 41 | + config_name = os.path.join(script, '..', 'dependencies.json') |
| 42 | + config = {} |
| 43 | + |
| 44 | + with open(config_name, "r") as f: |
| 45 | + config = json.loads(f.read()) |
| 46 | + config = uplift_linux_igfx_driver(config, platform_tag) |
| 47 | + |
| 48 | + with open(config_name, "w") as f: |
| 49 | + json.dump(config, f, indent=2) |
| 50 | + |
| 51 | + return config[platform_tag]['compute_runtime']['version'] |
| 52 | + |
| 53 | + |
| 54 | +if __name__ == '__main__': |
| 55 | + platform_tag = sys.argv[1] if len(sys.argv) > 1 else 'linux_staging' |
| 56 | + sys.stdout.write(main(platform_tag) + '\n') |
0 commit comments