Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back compatibility with HDF5 < v1.12 #756

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ else
if libhdf5_size != filesize(Libdl.dlpath(libhdf5))
Copy link
Member

@musm musm Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/JuliaIO/HDF5.jl/blob/master/Project.toml will also need ~1.10.5. I'd also update https://github.com/JuliaIO/HDF5.jl/blob/master/HISTORY.md and add a new section with v0.14.3 to mention these recent changes that we brought back v1.10.5 BB support and the minimum guaranteed version.

error("HDF5 library has changed, re-run Pkg.build(\\\"HDF5\\\")")
end
if libversion < v"1.12"
error("HDF5.jl requires ≥ v1.12 of the HDF5 library.")
Copy link
Member

@musm musm Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@warn  "HDF5.jl requires ... use at your own risk ...

Or something along those lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

Maybe it would be better if it's only printed when HDF5.jl is built (here it would be printed every time HDF5.jl is loaded), but I don't know if that's possible.

Or maybe we could read an environment variable which would disable warnings, as in:

if libversion < v"1.12" && get(ENV, "JULIA_HDF5_NOWARN", "0") == "0"
    @warn "HDF5.jl requires ≥ v1.12 of the HDF5 library, but v\$libversion was detected. Use at your own risk..."
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to check if JULIA_HDF5_LIBRARY_PATH is not set to nothing

Copy link
Member

@musm musm Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or actually move this warning up in the file instead. (i.e. don't' write this out)

I don't think that will actually work, since the library would need to be loaded first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we could load it at build time, just to get the library version. Note that this will only be done when JULIA_HDF5_LIBRARY_PATH is set.

Copy link
Contributor Author

@jipolanco jipolanco Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried this, but the problem is that by default nothing is printed to the terminal when building a package. This is unless --verbose is explicitly passed, e.g. ]build --verbose HDF5.

end
end
"""
)
Expand Down
11 changes: 7 additions & 4 deletions test/plain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,19 @@ dspace_scal = HDF5.Dataspace(HDF5.h5s_create(HDF5.H5S_SCALAR))
dspace_norm = dataspace((100, 4))
dspace_maxd = dataspace((100, 4), max_dims = (256, 4))
dspace_slab = HDF5.hyperslab(dataspace((100, 4)), 1:20:100, 1:4)
dspace_irrg = HDF5.Dataspace(HDF5.h5s_combine_select(
HDF5.h5s_copy(dspace_slab), HDF5.H5S_SELECT_OR,
HDF5.hyperslab(dataspace((100, 4)), 2, 2)))

@test sprint(show, dspace_null) == "HDF5.Dataspace: H5S_NULL"
@test sprint(show, dspace_scal) == "HDF5.Dataspace: H5S_SCALAR"
@test sprint(show, dspace_norm) == "HDF5.Dataspace: (100, 4)"
@test sprint(show, dspace_maxd) == "HDF5.Dataspace: (100, 4) / (256, 4)"
@test sprint(show, dspace_slab) == "HDF5.Dataspace: (1:20:81, 1:4) / (1:100, 1:4)"
@test sprint(show, dspace_irrg) == "HDF5.Dataspace: (100, 4) [irregular selection]"

if HDF5.libversion ≥ v"1.10.7"
dspace_irrg = HDF5.Dataspace(HDF5.h5s_combine_select(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the HDF5.h5s_combine_select that's failing here?

Apparently that should be available on 1.10.7

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point... I was testing with 1.10.4, which is why it fails for me.

Note that 1.10.7 is relatively recent, as it was released in September.

HDF5.h5s_copy(dspace_slab), HDF5.H5S_SELECT_OR,
HDF5.hyperslab(dataspace((100, 4)), 2, 2)))
@test sprint(show, dspace_irrg) == "HDF5.Dataspace: (100, 4) [irregular selection]"
end

# Now test printing after closing each object

Expand Down