Skip to content

Commit

Permalink
feat: avoid adding packages that exist in the sysimage
Browse files Browse the repository at this point in the history
  • Loading branch information
pankgeorg committed Feb 29, 2024
1 parent 017a084 commit 123cadf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/packages/Packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function sync_nbpkg_core(
new_packages = String.(external_package_names(new_topology)) # search all cells for imports and usings

removed = setdiff(old_packages, new_packages)
added = setdiff(new_packages, old_packages)
added = setdiff(new_packages, old_packages, PkgCompat.sysimage_module_names()) # Avoid adding the modules of the sysimage
can_skip = isempty(removed) && isempty(added) && notebook.nbpkg_ctx_instantiated

iolistener = let
Expand Down
8 changes: 8 additions & 0 deletions src/packages/PkgCompat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ function project(ctx::PkgContext)
end
end

function sysimage_module_names()
@static if isdefined(Base, Symbol("_sysimage_modules"))
getproperty.(Base._sysimage_modules, :name)
else
String[]
end
end

# 🐸 "Public API", but using PkgContext
"Find a package in the manifest. Return `nothing` if not found."
_get_manifest_entry(ctx::PkgContext, package_name::AbstractString) =
Expand Down

0 comments on commit 123cadf

Please sign in to comment.