-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936d30e
commit 0cdca9e
Showing
4 changed files
with
33 additions
and
10 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 |
---|---|---|
@@ -1,12 +1,36 @@ | ||
# Prefer GAPInfo.UserGapRoot over other package directories to prevent accidentally testing package | ||
# versions distributed with GAP. | ||
(function() | ||
|
||
FORCE_LOADING_FROM_USER_GAP_ROOT := function ( ) | ||
local name, package_info, pos; | ||
for name in RecNames( GAPInfo.PackagesInfo ) do | ||
package_info := GAPInfo.PackagesInfo.(name); | ||
pos := PositionProperty( package_info, info -> StartsWith( info.InstallationPath, GAPInfo.UserGapRoot ) ); | ||
if pos <> fail then | ||
SetPackagePath( name, package_info[pos].InstallationPath ); | ||
# work around https://github.com/gap-system/gap/pull/5178 | ||
if IsBound( GAPInfo.PackagesLoaded.(name) ) then | ||
if StartsWith( GAPInfo.PackagesLoaded.(name)[1], GAPInfo.UserGapRoot ) then | ||
continue; | ||
else | ||
Error( "package already loaded at ", GAPInfo.PackagesLoaded.(name)[1] ); | ||
fi; | ||
else | ||
SetPackagePath( name, package_info[pos].InstallationPath ); | ||
fi; | ||
fi; | ||
od; | ||
end)(); | ||
end; | ||
|
||
FORCE_LOADING_FROM_USER_GAP_ROOT( ); | ||
|
||
MakeReadWriteGlobal( "InitializePackagesInfoRecords" ); | ||
FORCE_LOADING_FROM_USER_GAP_ROOT_InitializePackagesInfoRecords_orig := InitializePackagesInfoRecords; | ||
InitializePackagesInfoRecords := function ( args... ) | ||
local old_PackagesInfo; | ||
old_PackagesInfo := GAPInfo.PackagesInfo; | ||
CallFuncList( FORCE_LOADING_FROM_USER_GAP_ROOT_InitializePackagesInfoRecords_orig, args ); | ||
if not IsIdenticalObj( old_PackagesInfo, GAPInfo.PackagesInfo ) then | ||
FORCE_LOADING_FROM_USER_GAP_ROOT( ); | ||
fi; | ||
end; | ||
MakeReadOnlyGlobal( "InitializePackagesInfoRecords" ); |
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