Fix max(stable_versions) on Julia version finding (#2076)

* Fix `max(stable_versions)`

Since the keys are semantic version strings, that means that `"1.9.4" > "1.10.0", which we know isn't true. 🙂

I just added some code to convert the string to tuples, find the max, then convert back to a string.

I first noticed this on the `2024-01-05` build of the `datascience-notebook`, since Julia 1.10.0 was released ~2 weeks ago: https://github.com/JuliaLang/julia/releases/tag/v1.10.0.

* Migrate to comparator on `max(stable_versions)`

* Update setup_julia.py

* Update setup_julia.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
John Muchovej
2024-01-06 12:09:30 -05:00
committed by GitHub
parent 06cdadd0bf
commit c515e883ea

View File

@@ -36,7 +36,10 @@ def get_latest_julia_url() -> tuple[str, str]:
"https://julialang-s3.julialang.org/bin/versions.json"
).json()
stable_versions = {k: v for k, v in versions.items() if v["stable"]}
latest_version_files = stable_versions[max(stable_versions)]["files"]
latest_stable_version = max(
stable_versions, key=lambda ver: [int(sub_ver) for sub_ver in ver.split(".")]
)
latest_version_files = stable_versions[latest_stable_version]["files"]
triplet = unify_aarch64(platform.machine()) + "-linux-gnu"
file_info = [vf for vf in latest_version_files if vf["triplet"] == triplet][0]
return file_info["url"], file_info["version"]