From 83e428d22dbf22357e9ca96adb71f0d1c5abff46 Mon Sep 17 00:00:00 2001 From: Joe Edwards <80713360+Joseph-Edwards@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:27:40 +0100 Subject: [PATCH] Better kernel module checking (#1032) * Better kernel module checking * fix linting * better error messages * fix linting * fix linting again * Change Semigroups -> semigroups --- PackageInfo.g | 11 ++++------- init.g | 10 ++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/PackageInfo.g b/PackageInfo.g index 811c48dd5..1365f7bc5 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -375,7 +375,7 @@ PackageDoc := rec( ), Dependencies := rec( - GAP := ">=4.12.0", + GAP := ">=4.12.1", NeededOtherPackages := [["datastructures", ">=0.2.5"], ["digraphs", ">=1.6.2"], ["genss", ">=1.6.5"], @@ -406,13 +406,10 @@ BannerString := Concatenation( "------\n"), AvailabilityTest := function() - local semigroups_so; - semigroups_so := Filename(DirectoriesPackagePrograms("semigroups"), - "semigroups.so"); - if (not "semigroups" in SHOW_STAT()) and semigroups_so = fail then + if not IsKernelExtensionAvailable("semigroups") then LogPackageLoadingMessage(PACKAGE_WARNING, - "the kernel module is not compiled, ", - "the package cannot be loaded."); + ["the kernel module is not compiled, ", + "the package cannot be loaded."]); return fail; fi; return true; diff --git a/init.g b/init.g index 94a5aa193..1c01899ef 100644 --- a/init.g +++ b/init.g @@ -13,15 +13,9 @@ if not IsBound(ORBC) then BindGlobal("HTValue_TreeHash_C", fail); fi; -# the kernel module makes use of the c functions HTAdd_TreeHash_C and -# HTValue_TreeHash_C and so we should only use the part of the kernel module -# using these functions if Orb is compiled. -_SEMIGROUPS_SO := Filename(DirectoriesPackagePrograms("semigroups"), - "semigroups.so"); -if _SEMIGROUPS_SO <> fail then - LoadDynamicModule(_SEMIGROUPS_SO); +if LoadKernelExtension("semigroups") = false then + Error("failed to load Semigroups kernel extension"); fi; -Unbind(_SEMIGROUPS_SO); if not IsBound(UserHomeExpand) then BindGlobal("UserHomeExpand", USER_HOME_EXPAND);