Skip to content

Commit

Permalink
Use gap's --packagedirs instead of symlinking in gaproot
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jan 6, 2025
1 parent 5913857 commit 62fb67e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/GAP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ if Sys.iswindows()
end

import AbstractAlgebra # for should_show_banner()
import Artifacts: find_artifacts_toml, @artifact_str
import TOML

import GAP_jll: GAP_jll, libgap

Expand Down Expand Up @@ -254,6 +256,12 @@ function __init__()

gaproots = sysinfo["GAPROOTS"]
cmdline_options = ["", "-l", gaproots]

# tell GAP about all artifacts that contain GAP packages
pkg_artifacts = filter(startswith("GAP_pkg_"), keys(TOML.parsefile(find_artifacts_toml(@__FILE__))))
pkgdirs = join((realpath(@artifact_str(name)) for name in pkg_artifacts), ';')
append!(cmdline_options, ["--packagedirs", pkgdirs])

if isdefined(Main, :__GAP_ARGS__)
# we were started via gap.sh, handle user command line arguments
append!(cmdline_options, Main.__GAP_ARGS__)
Expand Down
12 changes: 1 addition & 11 deletions src/setup.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module Setup

using Pkg: GitTools
import Artifacts: find_artifacts_toml, @artifact_str
import GAP_jll
import GAP_lib_jll
import GAP_pkg_juliainterface_jll
import Scratch: @get_scratch!
import Pidfile
import TOML

# to separate the scratchspaces of different GAP.jl copies and Julia versions
# put the Julia version and the hash of the path to this file into the key
const scratch_key = "gap_$(hash(@__FILE__))-$(VERSION.major).$(VERSION.minor)"
const scratch_key = "gap_$(hash(@__FILE__))-nopkg-$(VERSION.major).$(VERSION.minor)"

gaproot() = @get_scratch!(scratch_key)

Expand Down Expand Up @@ -183,14 +181,6 @@ function regenerate_gaproot()
gac = replace(gac, r"^\. \"[^\"]+\"$"m => ". \"$(gaproot_mutable)/sysinfo.gap\"")
write("$gaproot_mutable/gac", gac)
chmod("$gaproot_mutable/gac", 0o755)

# create a `pkg` directory with symlinks to all the GAP packages artifacts
mkpath(joinpath(gaproot_mutable, "pkg"))
pkg_artifacts = filter(startswith("GAP_pkg_"), keys(TOML.parsefile(find_artifacts_toml(@__FILE__))))
for name in pkg_artifacts
force_symlink(@artifact_str(name), joinpath(gaproot_mutable, "pkg", name))
end

end # mkpidlock

return sysinfo
Expand Down

0 comments on commit 62fb67e

Please sign in to comment.