Skip to content

Avoid using standard import in JLL for cases like JULIA_LOAD_PATH=@ julia1.6 -e "using OpenSpecFun_jll" #1007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/AutoBuild.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,28 @@ function rebuild_jll_package(name::String, build_version::VersionNumber, sources
kwargs...)
end

function print_import(io::IO, pkg)
pkg = getpkg(pkg) # Pkg.PackageSpec
if pkg.uuid === nothing
# TODO: is it possible? should we just error out?
println(io, "using $(getname(pkg))")
else
# The script generaged for jll is directly included via JLLWrappers.jl at run-time.
# However, since there is no gurantee that the dependencies are in the top-level
# dependencies of `Project.toml` in the current load path, we cannot use the
# standard import mechanism.
# Ref: https://github.com/JuliaLang/julia/issues/39631
name = getname(pkg)
uuid = string(pkg.uuid)
println(
io,
"""
const $name = Base.require(Base.PkgId(Base.UUID($(repr(uuid))), $(repr(name))))
using .$name
""")
end
end

function build_jll_package(src_name::String,
build_version::VersionNumber,
sources::Vector,
Expand Down Expand Up @@ -1105,7 +1127,7 @@ function build_jll_package(src_name::String,
""")
end
for dep in dependencies
println(io, "using $(getname(dep))")
print_import(io, dep)
end

# Generate header definitions like `find_artifact_dir()`
Expand Down