| 42 | |
| 43 | |
| 44 | def install(): |
| 45 | m = f"{platform.system()}-{platform.machine()}" |
| 46 | supported = ("Linux-x86_64", "Linux-aarch64", "Darwin-arm64") |
| 47 | if m not in supported: |
| 48 | raise Exception(f"Unsupported platform: '{m}'. Supported platforms: {supported}") |
| 49 | |
| 50 | if os.path.exists(INSTALL_DIR): |
| 51 | shutil.rmtree(INSTALL_DIR) |
| 52 | os.mkdir(INSTALL_DIR) |
| 53 | |
| 54 | url = os.path.join(RELEASES_URL, m + ".tar.gz") |
| 55 | with requests.get(url, stream=True, timeout=10) as r, tempfile.NamedTemporaryFile() as tmp: |
| 56 | r.raise_for_status() |
| 57 | with open(tmp.name, 'wb') as tmpf: |
| 58 | for chunk in r.iter_content(chunk_size=1024 * 1024): |
| 59 | tmpf.write(chunk) |
| 60 | |
| 61 | with tarfile.open(tmp.name) as tar: |
| 62 | tar.extractall(path=INSTALL_DIR, filter="data") |
| 63 | |
| 64 | |
| 65 | def get_plotjuggler_version(): |