Skip to content

Commit

Permalink
Allow compiled binaries to get version
Browse files Browse the repository at this point in the history
We started using the function that julia provides, but it doesn't seem to work with compiled binaries
Fixes #364
  • Loading branch information
Hofer-Julian committed Jan 29, 2024
1 parent 194e2e8 commit 1787fc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/libribasim/src/libribasim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ end

Base.@ccallable function get_version(version::Cstring)::Cint
@try_c_uninitialized begin
ribasim_version = pkgversion(Ribasim)
ribasim_version = Ribasim.pkgversion(Ribasim)
unsafe_write_to_cstring!(version, string(ribasim_version))
end
end
Expand Down
8 changes: 8 additions & 0 deletions core/src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"Get the package version of a given module"
function pkgversion(m::Module)::VersionNumber
rootmodule = Base.moduleroot(m)
pkg = Base.PkgId(rootmodule)
pkgorigin = get(Base.pkgorigins, pkg, nothing)
return pkgorigin.version
end

"Check that only supported edge types are declared."
function valid_edge_types(db::DB)::Bool
edge_rows = execute(
Expand Down
1 change: 0 additions & 1 deletion python/ribasim_api/tests/test_bmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_get_component_name(libribasim):
assert libribasim.get_component_name() == "Ribasim"


@pytest.mark.skip("https://github.com/Deltares/Ribasim/issues/364")
def test_get_version(libribasim):
toml_path = Path(__file__).parents[3] / "core" / "Project.toml"
with open(toml_path, mode="rb") as fp:
Expand Down

0 comments on commit 1787fc0

Please sign in to comment.