Skip to content

Commit

Permalink
Fix precompilation Julia 1.11 (#3054)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Oct 14, 2024
1 parent 56256df commit 25f4197
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/packages/Packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,12 @@ function sync_nbpkg_core(
used_tier = tier

try
Pkg.add(notebook.nbpkg_ctx, [
Pkg.PackageSpec(name=p)
for p in to_add
]; preserve=used_tier)
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
Pkg.add(notebook.nbpkg_ctx, [
Pkg.PackageSpec(name=p)
for p in to_add
]; preserve=used_tier)
end

break
catch e
Expand Down Expand Up @@ -581,10 +583,12 @@ function update_nbpkg_core(
phasemessage(iolistener, "Updating packages")
# We temporarily clear the "semver-compatible" [deps] entries, because it is difficult to update them after the update 🙈. TODO
PkgCompat.clear_auto_compat_entries!(notebook.nbpkg_ctx)

try
###
Pkg.update(notebook.nbpkg_ctx; level=level)
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
Pkg.update(notebook.nbpkg_ctx; level=level)
end
###
finally
PkgCompat.write_auto_compat_entries!(notebook.nbpkg_ctx)
Expand Down
7 changes: 6 additions & 1 deletion src/packages/PkgCompat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ end

# I'm a pirate harrr 🏴‍☠️
@static if isdefined(Pkg, :can_fancyprint)
Pkg.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) = get(io, :sneaky_enable_tty, false) === true
Pkg.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
get(io, :sneaky_enable_tty, false) === true
end
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
Base.Precompilation.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
get(io, :sneaky_enable_tty, false) === true
end

###
Expand Down
3 changes: 3 additions & 0 deletions src/packages/precompile_isolated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function precompile_isolated(
@static if isdefined(Pkg, :can_fancyprint)
Pkg.can_fancyprint(io::IO) = true
end
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
Base.Precompilation.can_fancyprint(io::IO) = true
end
Pkg.activate($(repr(environment)); io=out_stream)
Pkg.precompile(; already_instantiated=true, io=out_stream)
Expand Down

0 comments on commit 25f4197

Please sign in to comment.