|
| 1 | +#!/usr/bin/env python3 |
| 2 | +import os |
| 3 | +import sys |
| 4 | +import subprocess |
| 5 | +import requests |
| 6 | +import json |
| 7 | + |
| 8 | +OWNER = "ManiVaultStudio" |
| 9 | +REPOS = [ |
| 10 | + ("Scatterplot", "View", "master"), |
| 11 | + ("ImageViewerPlugin", "View", "master"), |
| 12 | + ("HeatMap", "View", "master"), |
| 13 | + ("ParallelCoordinatesPlugin", "View", "master"), |
| 14 | + ("SpectralViewPlugin", "View", "main"), |
| 15 | + ("t-SNE-Analysis", "Analysis", "master"), |
| 16 | + ("MeanShiftClustering", "Analysis", "master"), |
| 17 | + ("PcaPlugin", "Analysis", "main"), |
| 18 | + ("SpidrPlugin", "Analysis", "main"), |
| 19 | + ("BinIO", "IO", "master"), |
| 20 | + ("ExtCsvLoader", "IO", "main"), |
| 21 | + ("ImageLoaderPlugin", "IO", "master"), |
| 22 | + ("HDF5Loader", "IO", "master"), |
| 23 | + ("UMAP-Plugin", "Analysis", "main"), |
| 24 | +] |
| 25 | + |
| 26 | +CORE_PREFIX = os.environ.get("CORE_PREFIX") |
| 27 | +if not CORE_PREFIX: |
| 28 | + sys.exit("ERROR: Please set CORE_PREFIX, e.g. export CORE_PREFIX=release/core_1.3/") |
| 29 | + |
| 30 | +# Derive core version |
| 31 | +core_ver = CORE_PREFIX.removeprefix("release/core_").rstrip("/") |
| 32 | + |
| 33 | +# Markdown header |
| 34 | +lines = [ |
| 35 | + "| Plugin | Type | Compatible Core | Version | Active | Status |", |
| 36 | + "|--------|:----:|:--------:|:----------------:|:------:|:------:|", |
| 37 | +] |
| 38 | + |
| 39 | +# Helpers |
| 40 | +def fetch_json(url): |
| 41 | + r = requests.get(url, timeout=10) |
| 42 | + return r.json() if r.status_code == 200 else None |
| 43 | + |
| 44 | +for repo, ptype, branch in REPOS: |
| 45 | + # badges |
| 46 | + active = f"" |
| 47 | + status = f"" |
| 48 | + |
| 49 | + # Try PluginInfo.json |
| 50 | + info_url = f"https://raw.githubusercontent.com/{OWNER}/{repo}/{branch}/PluginInfo.json" |
| 51 | + info = fetch_json(info_url) |
| 52 | + |
| 53 | + if info: |
| 54 | + plugin_name = info.get("name", repo) |
| 55 | + core_version = ", ".join(info.get("version", {}).get("core", [])) or core_ver |
| 56 | + plugin_version = info.get("version", {}).get("plugin", "N/A") |
| 57 | + else: |
| 58 | + plugin_name = repo |
| 59 | + core_version = core_ver |
| 60 | + |
| 61 | + # Fetch branches |
| 62 | + api_url = f"https://api.github.com/repos/{OWNER}/{repo}/branches?per_page=100" |
| 63 | + branches = fetch_json(api_url) or [] |
| 64 | + suffixes = [ |
| 65 | + b["name"].removeprefix(CORE_PREFIX) |
| 66 | + for b in branches |
| 67 | + if b["name"].startswith(CORE_PREFIX) |
| 68 | + ] |
| 69 | + plugin_version = ", ".join(suffixes) if suffixes else "N/A" |
| 70 | + |
| 71 | + lines.append( |
| 72 | + f"| [{plugin_name}](https://github.com/{OWNER}/{repo})" |
| 73 | + f" | {ptype} | {core_version} | {plugin_version}" |
| 74 | + f" | {active} | {status} |" |
| 75 | + ) |
| 76 | + |
| 77 | +print("\n".join(lines)) |
0 commit comments