[python-hdf5storage] 29/84: Fix h5py version detection on old h5py
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:25:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.10
in repository python-hdf5storage.
commit 603aa1a6860f1f92e64008271f4ee6c9b73b62be
Author: Steven Dee <steven at interaxon.ca>
Date: Thu Dec 18 12:43:36 2014 -0500
Fix h5py version detection on old h5py
Ubuntu 12.04's python-h5py is v2.0.1 and doesn't have a __version__.
If we fail to get one, just assume it's 2.0.
---
hdf5storage/Marshallers.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 262c1e8..0b41f1b 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -41,6 +41,11 @@ from hdf5storage import lowlevel
from hdf5storage.lowlevel import write_data, read_data
+try:
+ H5PY_VERSION = h5py.__version__
+except:
+ H5PY_VERSION = '2.0'
+
def write_object_array(f, data, options):
""" Writes an array of objects recursively.
@@ -538,7 +543,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
self.matlab_classes = list(self.__MATLAB_classes.values())
# For h5py >= 2.2, half precisions (np.float16) are supported.
- if distutils.version.LooseVersion(h5py.__version__) \
+ if distutils.version.LooseVersion(H5PY_VERSION) \
>= distutils.version.LooseVersion('2.2'):
self.types.append(np.float16)
self.python_type_strings.append('numpy.float16')
@@ -848,7 +853,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
# individual characters.
if options.matlab_compatible \
and distutils.version.LooseVersion( \
- h5py.__version__) \
+ H5PY_VERSION) \
>= distutils.version.LooseVersion('2.3'):
try:
dt = h5py.special_dtype(vlen=np.dtype('S1'))
@@ -944,7 +949,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
# If we are using h5py version >= 2.3, we can actually read the
# MATLAB_fields Attribute if it is present.
matlab_fields = None
- if distutils.version.LooseVersion(h5py.__version__) \
+ if distutils.version.LooseVersion(H5PY_VERSION) \
>= distutils.version.LooseVersion('2.3'):
matlab_fields = get_attribute(grp[name], 'MATLAB_fields')
@@ -1490,7 +1495,7 @@ class PythonDictMarshaller(TypeMarshaller):
# should be deleted. It is written as a vlen='S1' array of
# bytes_ arrays of the individual characters.
if options.matlab_compatible \
- and distutils.version.LooseVersion(h5py.__version__) \
+ and distutils.version.LooseVersion(H5PY_VERSION) \
>= distutils.version.LooseVersion('2.3'):
try:
dt = h5py.special_dtype(vlen=np.dtype('S1'))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git
More information about the debian-science-commits
mailing list