-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rearrange how Oscar loads GAP packages at runtime (#3874)
* rearrange how Oscar loads GAP packages at runtime - GAP package OscarInterface: add dependency Polycyclic (formally needed) - loading order of GAP packages: - in the beginning, install recog via a URL - load OscarInterface in the end * install GAP's Recog package via a dedicated Oscar function This will update the package from its git repository each time Oscar gets started; this is a bad idea, but otherwise we cannot get rid of older versions * really update the GAP package if it is already installed
- Loading branch information
1 parent
58abe47
commit 8163ba8
Showing
4 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Install a GAP package via the URL of a GIT repository. | ||
# If the package was already installed then update the installation, | ||
# otherwise clone the repository. | ||
# (The code is a modified copy of GAP's `InstallPackageFromGit`.) | ||
function GAP_Packages_install(url::String; interactive::Bool = false, branch::String = "") | ||
# point PackageManager to GAP.jl's pkg dir | ||
GAP.Globals.PKGMAN_CustomPackageDir = GapObj(GAP.Packages.DEFAULT_PKGDIR[]) | ||
# avoid info messages from PackageManager | ||
GAP.Globals.SetInfoLevel(GAP.Globals.InfoPackageManager, 0) | ||
|
||
url = GapObj(url) | ||
name = GAP.Globals.PKGMAN_NameOfGitRepo(url) | ||
name === GAP.Globals.fail && return false | ||
dir = GAP.Globals.Filename(GAP.Globals.Directory(GAP.Globals.PKGMAN_PackageDir()), name) | ||
|
||
# check for existing repository | ||
allinfo = GAP.Globals.PackageInfo(name) | ||
info = GAP.Globals.Filtered(allinfo, | ||
x -> GAP.Globals.StartsWith(x.InstallationPath, GAP.Globals.PKGMAN_PackageDir())) | ||
dirs = GAP.Globals.List(info, i -> i.InstallationPath) | ||
repo = GAP.Globals.Filename(GAP.Globals.List(dirs, GAP.Globals.Directory), GapObj(".git")); | ||
if repo !== GAP.Globals.fail | ||
# the package is already installed, update it | ||
return GAP.Globals.UpdatePackage(name, interactive) | ||
end | ||
|
||
! GAP.Globals.PKGMAN_IsValidTargetDir(dir) && return false | ||
if branch == "" | ||
exec = GAP.Globals.PKGMAN_Exec(GapObj("."), GapObj("git"), GapObj("clone"), url, dir) | ||
else | ||
exec = GAP.Globals.PKGMAN_Exec(GapObj("."), GapObj("git"), GapObj("clone"), url, dir, GapObj("-b"), GapObj(branch)) | ||
end | ||
|
||
(exec === GAP.Globals.fail || exec.code != 0) && return false | ||
GAP.Globals.PKGMAN_RefreshPackageInfo() | ||
|
||
# check for PackageInfo.g | ||
info = GAP.Globals.Filename(GAP.Globals.Directory(dir), GapObj("PackageInfo.g")); | ||
if ! GAP.Globals.IsReadableFile(info) | ||
if GAP.Globals.ValueOption("debug") != true | ||
GAP.Globals.PKGMAN_RemoveDir(dir) | ||
end | ||
return false | ||
end | ||
|
||
# install dependencies | ||
if GAP.Globals.PKGMAN_InstallDependencies(dir) != true | ||
if GAP.Globals.ValueOption("debug") != true | ||
GAP.Globals.PKGMAN_RemoveDir(dir) | ||
end | ||
return false | ||
end | ||
|
||
# compile, make doc, and check | ||
#TODO: build the documentation once PackageManager sets the right current directory, | ||
# return GAP.Globals.PKGMAN_CheckPackage(dir) | ||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ include("docs.jl") | |
include("tests.jl") | ||
include("rand.jl") | ||
include("parallel.jl") | ||
include("install.jl") |