Skip to content

Commit

Permalink
Make AvailabilityTest for packages optional
Browse files Browse the repository at this point in the history
If missing we assume it is ReturnTrue which is what >= 100 of our packages use.
  • Loading branch information
fingolfin committed Nov 1, 2024
1 parent 2664be8 commit 628aa37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions doc/ref/gappkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,6 @@ The following components of this record are <E>mandatory</E>.
</Item>
</List>
</Item>
<Mark><C>AvailabilityTest</C></Mark>
<Item>
a function with no arguments that returns <K>true</K> if the package is
available, and <K>false</K> otherwise
(can be <Ref Func="ReturnTrue"/> if the package consists only of &GAP;
code).
</Item>
</List>

The following components of the record are <E>optional</E>.
Expand Down Expand Up @@ -384,6 +377,13 @@ The following components of the record are <E>optional</E>.
</Item>
</List>
</Item>
<Mark><C>AvailabilityTest</C></Mark>
<Item>
a function with no arguments that returns <K>true</K> if the package is
available, and <K>false</K> otherwise
(can be <Ref Func="ReturnTrue"/> if the package consists only of &GAP;
code; this is also the default value),
</Item>
<Mark><C>BannerString</C> or <C>BannerFunction</C></Mark>
<Item>
a string or a function, respectively,
Expand Down
2 changes: 1 addition & 1 deletion lib/gpfpiso.gi
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function(g,str,N)
fi;

# the range is elementary. Use this for the fp group isomorphism
f:=Range(hom);
f:=Image(hom);
# calculate automorphisms of f induced by G
fgens:=GeneratorsOfGroup(f);
auts:=List(GeneratorsOfGroup(g),i->
Expand Down
4 changes: 2 additions & 2 deletions lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ InstallGlobalFunction( PackageAvailabilityInfo,

# Test whether the availability test function fits.
GAPInfo.PackageCurrent:= inforec;
test:= inforec.AvailabilityTest();
test:= (not IsBound(inforec.AvailabilityTest)) or inforec.AvailabilityTest();
Unbind( GAPInfo.PackageCurrent );
if test = true then
LogPackageLoadingMessage( PACKAGE_DEBUG,
Expand Down Expand Up @@ -2522,7 +2522,7 @@ InstallGlobalFunction( ValidatePackageInfo, function( info )
ForAll( l, IsString ) ) and
IsBound( r.filename ) and IsString( r.filename ) ),
"a list of records with components `needed' and `filename'" );
TestMandat( record, "AvailabilityTest", IsFunction, "a function" );
TestOption( record, "AvailabilityTest", IsFunction, "a function" );
TestOption( record, "BannerFunction", IsFunction, "a function" );
TestOption( record, "BannerString", IsString, "a string" );
TestOption( record, "TestFile", IsFilename,
Expand Down

0 comments on commit 628aa37

Please sign in to comment.