Skip to content

Commit

Permalink
Add in_sysimage(pkgid::PkgId) to check if a package is in the sysimage (
Browse files Browse the repository at this point in the history
#37652)

* add in_sysimage to check if a package is in the sysimage

* suggestion to empty _sysimage_modules first

Co-authored-by: Takafumi Arakaki <[email protected]>

* add tests for in_sysimage

* Fix typo in test

Co-authored-by: Takafumi Arakaki <[email protected]>
  • Loading branch information
IanButterworth and tkf authored Sep 21, 2020
1 parent 10e2455 commit 5a86131
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ include(mapexpr::Function, mod::Module, _path::AbstractString) = _include(mapexp

end_base_include = time_ns()

const _sysimage_modules = PkgId[]
in_sysimage(pkgid::PkgId) = pkgid in _sysimage_modules

if is_primary_base_module
function __init__()
# try to ensuremake sure OpenBLAS does not set CPU affinity (#1070, #9639)
Expand All @@ -405,6 +408,7 @@ function __init__()
init_depot_path()
init_load_path()
init_active_project()
append!(empty!(_sysimage_modules), keys(loaded_modules))
nothing
end

Expand Down
3 changes: 3 additions & 0 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ let exename = `$(Base.julia_cmd()) --compiled-modules=yes --startup-file=no`,
@test !endswith(s_dir, Base.Filesystem.path_separator)
end

@test Base.in_sysimage(Base.PkgId(Base.UUID("cf7118a7-6976-5b1a-9a39-7adc72f591a4"), "UUIDs"))
@test Base.in_sysimage(Base.PkgId(Base.UUID("3a7fdc7e-7467-41b4-9f64-ea033d046d5b"), "NotAPackage")) == false

# Issue #5789 and PR #13542:
mktempdir() do dir
cd(dir) do
Expand Down

2 comments on commit 5a86131

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.