This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.jl
40 lines (32 loc) · 1.49 KB
/
run.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This script builds libsingular-julia, then starts a fresh Julia instances
# with an appropriate override set for e.g. running the test suite or whatever
# else you'd like. Arguments are passed on verbatim to the subprocess julia,
# so you can invokes this kinda like you'd invoke Julia
@info "Install needed packages"
using Pkg
Pkg.add(["Singular_jll", "CxxWrap", "CMake", "libsingular_julia_jll"])
using libsingular_julia_jll
@info "Build libsingular-julia"
include("build.jl")
mktempdir() do tmpdepot
@info "Created temporary depot at $(tmpdepot)"
# create override file for libsingular_julia_jll
uuid = string(Base.identify_package("libsingular_julia_jll").uuid)
mkpath(joinpath(tmpdepot, "artifacts"))
open(joinpath(tmpdepot, "artifacts", "Overrides.toml"), "w") do f
write(f, """
[$(uuid)]
libsingular_julia = "$(installdir)"
""")
end
# prepend our temporary depot to the depot list...
withenv("JULIA_DEPOT_PATH"=>tmpdepot*":") do
# we need to make sure that precompilation is run again with the override in place
# (just running Pkg.precompile() does not seem to suffice)
run(`touch $(pathof(libsingular_julia_jll))`)
# ... and start Julia, by default with the same project environment
run(`$(Base.julia_cmd()) --project=$(Base.active_project()) $(ARGS)`)
# TODO: perform some additional steps here, e.g. perhaps
# verify that `libsingular_julia_jll.artifact_dir` is set right?
end
end