|
1 | 1 | using Test, Sandbox, Scratch, Pkg, Base.BinaryPlatforms
|
2 | 2 |
|
3 |
| -function get_nestable_julia(target_arch = arch(HostPlatform()), version=v"1.8.1") |
4 |
| - julia_dir = @get_scratch!("julia-$(target_arch)-$(version)") |
5 |
| - if !isfile(joinpath(julia_dir, "julia-$(version)", "bin", "julia")) |
| 3 | +curr_version() = VersionNumber(VERSION.major, VERSION.minor, VERSION.patch) |
| 4 | +function get_nestable_julia(target_arch = arch(HostPlatform()), version=VERSION) |
| 5 | + function get_julia_url() |
6 | 6 | arch_folder = target_arch
|
7 | 7 | if target_arch == "x86_64"
|
8 | 8 | arch_folder = "x64"
|
9 | 9 | elseif target_arch == "i686"
|
10 | 10 | arch_folder = "x86"
|
11 | 11 | end
|
12 |
| - url = "https://julialang-s3.julialang.org/bin/linux/$(arch_folder)/$(version.major).$(version.minor)/julia-$(version)-linux-$(target_arch).tar.gz" |
| 12 | + |
| 13 | + if !isempty(version.prerelease) |
| 14 | + # Get the latest version in this major.minor series: |
| 15 | + return "https://julialangnightlies-s3.julialang.org/bin/linux/$(target_arch)/$(version.major).$(version.minor)/julia-latest-linux-$(target_arch).tar.gz" |
| 16 | + else |
| 17 | + return "https://julialang-s3.julialang.org/bin/linux/$(arch_folder)/$(version.major).$(version.minor)/julia-$(version)-linux-$(target_arch).tar.gz" |
| 18 | + end |
| 19 | + end |
| 20 | + |
| 21 | + sanitized_version = VersionNumber(version.major, version.minor, version.patch) |
| 22 | + julia_dir = @get_scratch!("julia-$(target_arch)-$(sanitized_version)") |
| 23 | + if !isfile(joinpath(julia_dir, "julia-$(sanitized_version)", "bin", "julia")) |
| 24 | + url = get_julia_url() |
| 25 | + rm(julia_dir; force=true, recursive=true) |
13 | 26 | Pkg.PlatformEngines.download_verify_unpack(url, nothing, julia_dir; ignore_existence=true, verbose=true)
|
14 | 27 | end
|
15 |
| - return joinpath(julia_dir, "julia-$(version)") |
| 28 | + return joinpath(julia_dir, only(readdir(julia_dir))) |
16 | 29 | end
|
17 | 30 |
|
18 | 31 | @testset "Nesting Sandbox.jl" begin
|
|
0 commit comments