From 5847c8dbf0f40871f1c17f7c0f75c9c18164c34a Mon Sep 17 00:00:00 2001 From: mahlon <> Date: Mon, 31 Mar 2025 23:15:45 +0000 Subject: [PATCH] Don't lock versions into compiled constants, underpinning shared lib could be updated and we'd never know. FossilOrigin-Name: bb2f3334eee618c651acc8cd9859554f97ac29589145b17ac5d41b0f8bbada70 --- USAGE.md | 6 +++--- src/kuzu.nim | 6 +++--- src/kuzu/constants.nim | 3 --- tests/constants/t_knows_its_libversion.nim | 3 ++- tests/constants/t_knows_its_storage_version.nim | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/USAGE.md b/USAGE.md index ab98cde..4031349 100644 --- a/USAGE.md +++ b/USAGE.md @@ -34,14 +34,14 @@ versions might work. Don't count too heavily on it. :-) | v0.8.2 | v0.1.0 | You can use the `kuzuVersionCompatible()` function (along with the -`KUZU_VERSION` and `KUZU_LIBVERSION` constants) to quickly check if things are -looking right. +`kuzuGetVersion()` and the `KUZU_VERSION` constant) to quickly check if things +are looking right. ```nim import kuzu echo KUZU_VERSION #=> "0.1.0" -echo KUZU_LIBVERSION #=> "0.8.2" +echo kuzuGetVersion() #=> "0.8.2" echo kuzuVersionCompatible() #=> true ``` diff --git a/src/kuzu.nim b/src/kuzu.nim index e8a100d..e4a5e9e 100644 --- a/src/kuzu.nim +++ b/src/kuzu.nim @@ -31,14 +31,14 @@ include proc kuzuVersionCompatible*(): bool = ## Returns true if the system installed Kuzu library ## is the expected version of this library wrapper. - result = KUZU_EXPECTED_LIBVERSION == KUZU_LIBVERSION + result = KUZU_EXPECTED_LIBVERSION == $kuzuGetVersion() when isMainModule: echo "Nim-Kuzu version: ", KUZU_VERSION, ". Expected library version: ", KUZU_EXPECTED_LIBVERSION, "." - echo "Installed Kuzu library version ", KUZU_LIBVERSION, - " (storage version ", KUZU_STORAGE_VERSION, ")" + echo "Installed Kuzu library version ", kuzuGetVersion(), + " (storage version ", kuzuGetStorageVersion(), ")" if kuzuVersionCompatible(): echo "Versions match!" else: diff --git a/src/kuzu/constants.nim b/src/kuzu/constants.nim index 89587f2..60645c4 100644 --- a/src/kuzu/constants.nim +++ b/src/kuzu/constants.nim @@ -3,8 +3,5 @@ const KUZU_VERSION* = "0.1.0" const KUZU_EXPECTED_LIBVERSION* = "0.8.2" -let KUZU_LIBVERSION* = $kuzu_get_version() -let KUZU_STORAGE_VERSION* = kuzu_get_storage_version().int let KUZU_DEFAULT_CONFIG* = kuzu_default_system_config() - diff --git a/tests/constants/t_knows_its_libversion.nim b/tests/constants/t_knows_its_libversion.nim index 68dbaa5..0726687 100644 --- a/tests/constants/t_knows_its_libversion.nim +++ b/tests/constants/t_knows_its_libversion.nim @@ -3,5 +3,6 @@ import re import kuzu -assert KUZU_LIBVERSION.contains( re"^\d+\.\d+\.\d+(?:\.\d+)?$" ) +let version = $kuzuGetVersion() +assert version.contains( re"^\d+\.\d+\.\d+(?:\.\d+)?$" ) diff --git a/tests/constants/t_knows_its_storage_version.nim b/tests/constants/t_knows_its_storage_version.nim index 31f500c..012325b 100644 --- a/tests/constants/t_knows_its_storage_version.nim +++ b/tests/constants/t_knows_its_storage_version.nim @@ -2,5 +2,5 @@ import kuzu -assert KUZU_STORAGE_VERSION >= 36 +assert kuzuGetStorageVersion() >= 36