Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Aug 26, 2024
1 parent bec3a49 commit 0a3f64f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
19 changes: 14 additions & 5 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,20 @@ Dependencies := rec(

AvailabilityTest := function()
local dir, str;
dir := DirectoriesPackagePrograms("curlInterface");
if Filename(dir, "curl.so") = fail then
str := "kernel extension not compiled, package cannot be loaded";
LogPackageLoadingMessage(PACKAGE_WARNING, str);
return fail;
if CompareVersionNumbers(GAPInfo.Version, "4.12") then
if not IsKernelExtensionAvailable("curlinterface") then
LogPackageLoadingMessage(PACKAGE_WARNING,
["the kernel module is not compiled, ",
"the package cannot be loaded."]);
return fail;
fi;
else
dir := DirectoriesPackagePrograms("curlInterface");
if Filename(dir, "curl.so") = fail then
str := "kernel extension not compiled, package cannot be loaded";
LogPackageLoadingMessage(PACKAGE_WARNING, str);
return fail;
fi;
fi;
return true;
end,
Expand Down
16 changes: 12 additions & 4 deletions init.g
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
#
# Reading the declaration part of the package.
#
_PATH_SO:=Filename(DirectoriesPackagePrograms("curlInterface"), "curl.so");
if _PATH_SO <> fail then
LoadDynamicModule(_PATH_SO);

if CompareVersionNumbers(GAPInfo.Version, "4.12") then
if not LoadKernelExtension("curlinterface") then
Error("failed to load the curlinterface package kernel extension");
fi;
else
# TODO this clause can be removed once the package requires GAP>=4.12.1
_PATH_SO:=Filename(DirectoriesPackagePrograms("curlInterface"), "curl.so");
if _PATH_SO <> fail then
LoadDynamicModule(_PATH_SO);
fi;
Unbind(_PATH_SO);
fi;
Unbind(_PATH_SO);

# work around a bug in some PackageManager versions, see
# <https://github.com/gap-packages/PackageManager/pull/100>.
Expand Down

0 comments on commit 0a3f64f

Please sign in to comment.