Skip to content

Commit

Permalink
Show banner again by default
Browse files Browse the repository at this point in the history
... unless we are being loaded from Oscar (code for that taken from
Singular.jl); can (still) be overridden with the `GAP_SHOW_BANNER`
environment variable.
  • Loading branch information
fingolfin committed Apr 30, 2020
1 parent 8daa508 commit 4e3f0de
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/GAP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,37 @@ end
function run_it()
gaproots = abspath(joinpath(@__DIR__, "..")) * ";" * sysinfo["GAP_LIB_DIR"]
cmdline_options = ["", "-l", gaproots, "-T", "-A", "--nointeract", "-m", "1000m"]
if get(ENV, "GAP_SHOW_BANNER", "false") != "true"
if haskey(ENV, "GAP_SHOW_BANNER")
show_banner = ENV["GAP_SHOW_BANNER"] == "true"
else
show_banner = isinteractive() &&
!any(x->x.name in ["Oscar"], keys(Base.package_locks))
end

if !show_banner
# Do not show the main GAP banner by default.
push!(cmdline_options, "-b")
end
initialize(cmdline_options)

if !show_banner
# Leave it to GAP's `LoadPackage` whether package banners are shown.
# Note that a second argument `false` of this function suppresses the
# package banner,
# but no package banners can be shown if the `-b` option is `true`.
gap_module = @__MODULE__
Base.MainInclude.eval(
:(
begin
record = $gap_module.Globals.GAPInfo
record.CommandLineOptions =
$gap_module.Globals.ShallowCopy(record.CommandLineOptions)
record.CommandLineOptions.b = false
$gap_module.Globals.MakeImmutable(record.CommandLineOptions)
end
),
)
end
end

function __init__()
Expand All @@ -183,24 +209,6 @@ function __init__()
run_it()
end
register_GapObj()

if get(ENV, "GAP_SHOW_BANNER", "false") != "true"
# Leave it to GAP's `LoadPackage` whether package banners are shown.
# Note that a second argument `false` of this function suppresses the
# package banner,
# but no package banners can be shown if the `-b` option is `true`.
Base.MainInclude.eval(
:(
begin
record = $gap_module.Globals.GAPInfo
record.CommandLineOptions =
$gap_module.Globals.ShallowCopy(record.CommandLineOptions)
record.CommandLineOptions.b = false
$gap_module.Globals.MakeImmutable(record.CommandLineOptions)
end
),
)
end
end

function gap_exe()
Expand Down

0 comments on commit 4e3f0de

Please sign in to comment.