Skip to content

Commit c37c3a1

Browse files
Added .sh utility to generate PyScript <-> Pyodide versions map (#2406)
* Added .sh utility to generate PyScript <-> Pyodide versions map * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d8250f2 commit c37c3a1

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

core/pyodide.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

Comments
 (0)