|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# This script assumes the following folder structure: |
| 4 | +# ./pyscript - it must be a GitHub clone/fork |
| 5 | +# ./polyscript - it must be a GitHub clone/fork |
| 6 | +# |
| 7 | +# Running from ./pyscript/core via: |
| 8 | +# |
| 9 | +# cd ./pyscript/core |
| 10 | +# bash ./pyodide.sh |
| 11 | +# |
| 12 | +# will print a JSON compatible string like: |
| 13 | +# |
| 14 | +# { |
| 15 | +# "2024.10.1": "0.26.2", |
| 16 | +# ... |
| 17 | +# "2025.11.1": "0.29.0", |
| 18 | +# "": null |
| 19 | +# } |
| 20 | +# |
| 21 | +# Each key represents the PyScript release and each |
| 22 | +# value represents the Pyodide version used by that PyScript release. |
| 23 | +# |
| 24 | +# The last empty key with `null` value is used just to close the JSON object. |
| 25 | +# One could remove manually that entry as long as there are no dangling commas. |
| 26 | +# |
| 27 | + |
| 28 | +current_pyscript=$(git branch | grep \\* | cut -d ' ' -f2) |
| 29 | + |
| 30 | +echo "{" |
| 31 | +for release in $(git tag --list --sort=version:refname); do |
| 32 | + git checkout ${release} > /dev/null 2>&1 |
| 33 | + if test -e "package.json"; then |
| 34 | + polyscript=$(cat package.json | jq -r '.dependencies.polyscript') |
| 35 | + tag="v${polyscript:1:${#polyscript}-1}" |
| 36 | + cd ../../polyscript > /dev/null 2>&1 |
| 37 | + current_polyscript=$(git branch | grep \\* | cut -d ' ' -f2) |
| 38 | + git checkout ${tag} > /dev/null 2>&1 |
| 39 | + if test -e "versions/pyodide"; then |
| 40 | + echo " \"${release}\": \"$(cat versions/pyodide)\"," |
| 41 | + fi |
| 42 | + git checkout ${current_polyscript} > /dev/null 2>&1 |
| 43 | + cd - > /dev/null 2>&1 |
| 44 | + fi |
| 45 | + git checkout ${current_pyscript} > /dev/null 2>&1 |
| 46 | +done |
| 47 | +echo " \"\": null" |
| 48 | +echo "}" |
0 commit comments