From ab021155a19c9c8b6c869caa07c72dd8b5c113ee Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 7 Sep 2021 00:47:17 +0200 Subject: [PATCH] Add DirectoriesPackageProgramsOverrides For use in Julia wrapper packages for GAP packages that included a kernel extension or otherwise compiled code: they carry the (GAP) source code for a GAP package in one Julia artifact, and the compiled binary in another (via a JLL). It is easy enough to point GAP at the former, via `SetPackagePath`; but we need this patch to also handle the latter. --- lib/pkg.g | 12 ++++++++++++ src/GAP.jl | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 lib/pkg.g diff --git a/lib/pkg.g b/lib/pkg.g new file mode 100644 index 00000000..558f7722 --- /dev/null +++ b/lib/pkg.g @@ -0,0 +1,12 @@ +BindGlobal("DirectoriesPackageProgramsOverrides", rec()); +BindGlobal("DirectoriesPackageProgramsOriginal", DirectoriesPackagePrograms); + +MakeReadWriteGlobal("DirectoriesPackagePrograms"); +DirectoriesPackagePrograms := function(name) + name:= LowercaseString(name); + if IsBound(DirectoriesPackageProgramsOverrides.(name)) then + return [ Directory( DirectoriesPackageProgramsOverrides.(name) ) ]; + fi; + return DirectoriesPackageProgramsOriginal(name); +end; +MakeReadOnlyGlobal("DirectoriesPackagePrograms"); diff --git a/src/GAP.jl b/src/GAP.jl index 38a64bca..6b4374d3 100644 --- a/src/GAP.jl +++ b/src/GAP.jl @@ -156,6 +156,8 @@ function initialize(argv::Vector{String}) error("JuliaInterface could not be loaded") end + GAP.Globals.Read(GapObj(joinpath(@__DIR__, "..", "lib", "pkg.g"))) + # If we are in "stand-alone mode", stop here if handle_signals ccall((:SyInstallAnswerIntr, libgap), Cvoid, ())