Skip to content
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

enhance Packages.install #1019

Merged
merged 1 commit into from
Jul 3, 2024
Merged
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
26 changes: 26 additions & 0 deletions src/packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,32 @@ function install(spec::String, version::String = "";
if version == ""
res = Globals.InstallPackage(GapObj(spec), interactive; debug)
else
# We assume that `spec` is a package name.
# If the required version is already installed and can be loaded
# then do not ask for installing it again.
# (This avoids for example downloading the `PackageInfo.g` info.)
#TODO: Remove this step as soon as PackageManager contains it.
info = Globals.GAPInfo.PackagesLoaded
if hasproperty(info, spec)
# The package is already loaded.
# If the loaded version is the same as the required one
# then nothing is to do.
# (If the loaded version is *not* the required one
# then we can still try to install the required version.)
version == string(getproperty(info, spec)[2]) && return true
end
info = Globals.GAPInfo.PackagesInfo
if hasproperty(info, spec)
# The package is not yet loaded but may be available.
# If an available version has the required version number
# then nothing is to do.
for inforec in getproperty(info, spec)
if version == string(getproperty(inforec, :Version))
fun = getproperty(inforec, :AvailabilityTest)
fun() && return true
end
end
end
res = Globals.InstallPackage(GapObj(spec), GapObj(version), interactive; debug)
end
if quiet || debug
Expand Down
Loading