[h5py] 01/09: Import h5py_2.7.0~rc3.orig.tar.gz

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 25 14:28:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository h5py.

commit 307ed5838b3a194864ed984f312c2f43315f18d4
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Wed Jan 25 09:02:57 2017 +0000

    Import h5py_2.7.0~rc3.orig.tar.gz
---
 docs/conf.py               |  4 ++--
 h5py/h5r.pyx               |  2 +-
 h5py/h5t.pyx               | 35 +++++++++++++++++++++++++++++++----
 h5py/tests/old/test_h5t.py | 29 ++++++++++++++++-------------
 h5py/version.py            |  4 +---
 setup.py                   |  2 +-
 6 files changed, 52 insertions(+), 24 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 74c4c0e..a4fc316 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -53,9 +53,9 @@ copyright = u'2014, Andrew Collette and contributors'
 # built documents.
 #
 # The short X.Y version.
-version = '2.6'
+version = '2.7'
 # The full version, including alpha/beta/rc tags.
-release = '2.6.0'
+release = '2.7.0rc3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/h5py/h5r.pyx b/h5py/h5r.pyx
index 3a42275..394024f 100644
--- a/h5py/h5r.pyx
+++ b/h5py/h5r.pyx
@@ -30,7 +30,7 @@ def create(ObjectID loc not None, char* name, int ref_type, ObjectID space=None)
     """(ObjectID loc, STRING name, INT ref_type, SpaceID space=None)
     => ReferenceObject ref
 
-    Create a new reference. The value of ref_type detemines the kind
+    Create a new reference. The value of ref_type determines the kind
     of reference created:
 
     OBJECT
diff --git a/h5py/h5t.pyx b/h5py/h5t.pyx
index 70c01db..8221302 100644
--- a/h5py/h5t.pyx
+++ b/h5py/h5t.pyx
@@ -31,11 +31,14 @@ import operator
 from h5 import get_config
 import numpy as np
 from ._objects import phil, with_phil
+import platform
 
 cfg = get_config()
 
 PY3 = sys.version_info[0] == 3
 
+MACHINE = platform.machine()
+
 # === Custom C API ============================================================
 
 cpdef TypeID typewrap(hid_t id_):
@@ -946,9 +949,24 @@ cdef class TypeFloatID(TypeAtomicID):
         """
         H5Tset_inpad(self.id, <H5T_pad_t>pad_code)
 
-
     cdef object py_dtype(self):
         # Translation function for floating-point types
+
+        if MACHINE == 'ppc64el':
+            size = self.get_size()                  # int giving number of bytes
+            order = _order_map[self.get_order()]    # string with '<' or '>'
+
+            if size == 2 and not hasattr(np, 'float16'):
+                # This build doesn't have float16; promote to float32
+                return dtype(order+"f4")
+
+            if size > 8:
+                # The native NumPy longdouble is used for 96 and 128-bit floats
+                return dtype(order + "f" + str(np.longdouble(1).dtype.itemsize))
+
+            return dtype( _order_map[self.get_order()] + "f" + \
+                          str(self.get_size()) )
+
         order = _order_map[self.get_order()]    # string with '<' or '>'
 
         s_offset, e_offset, e_size, m_offset, m_size = self.get_fields()
@@ -957,13 +975,22 @@ cdef class TypeFloatID(TypeAtomicID):
         # Handle non-standard exponent and mantissa sizes.
         for size, finfo in sorted(available_ftypes.items()):
             nmant = finfo.nmant
-            if nmant == 63 and finfo.nexp == 15:
+            maxexp = finfo.maxexp
+            minexp = finfo.minexp
+            # workaround for numpy's buggy finfo on float128 on ppc64 archs
+            if size == 16 and MACHINE.startswith('ppc64'):
+                nmant = 116
+                maxexp = 1024
+                minexp = -1022
+            elif nmant == 63 and finfo.nexp == 15:
                 # This is an 80-bit float, correct mantissa size
                 nmant += 1
-            if m_size <= nmant and (2**e_size - e_bias - 1) <= finfo.maxexp and (1 - e_bias) >= finfo.minexp:
+            if (m_size <= nmant and
+                (2**e_size - e_bias - 1) <= maxexp and (1 - e_bias) >= minexp):
                 break
         else:
-            raise ValueError('Insufficient precision in available types to represent ' + str(self.get_fields()))
+            raise ValueError('Insufficient precision in available types to ' +
+                             'represent ' + str(self.get_fields()))
 
 
 
diff --git a/h5py/tests/old/test_h5t.py b/h5py/tests/old/test_h5t.py
index a263b73..f2f3063 100644
--- a/h5py/tests/old/test_h5t.py
+++ b/h5py/tests/old/test_h5t.py
@@ -30,8 +30,8 @@ class TestCompound(ut.TestCase):
         """ Reference types are correctly stored in compound types (issue 144)
         """
         ref = h5py.special_dtype(ref=h5py.Reference)
-        dt = np.dtype([('a',ref),('b','<f4')])
-        tid = h5t.py_create(dt,logical=True)
+        dt = np.dtype([('a', ref), ('b', '<f4')])
+        tid = h5t.py_create(dt, logical=True)
         t1, t2 = tid.get_member_type(0), tid.get_member_type(1)
         self.assertEqual(t1, h5t.STD_REF_OBJ)
         self.assertEqual(t2, h5t.IEEE_F32LE)
@@ -41,9 +41,9 @@ class TestCompound(ut.TestCase):
     def test_out_of_order_offsets(self):
         size = 20
         type_dict = {
-            'names' : ['f1', 'f2', 'f3'],
-            'formats' : ['<f4', '<i4', '<f8'],
-            'offsets' : [0, 16, 8]
+            'names': ['f1', 'f2', 'f3'],
+            'formats': ['<f4', '<i4', '<f8'],
+            'offsets': [0, 16, 8]
         }
 
         expected_dtype = np.dtype(type_dict)
@@ -67,6 +67,9 @@ class TestTypeFloatID(TestCase):
 
     def test_custom_float_promotion(self):
         """Custom floats are correctly promoted to standard floats on read."""
+        if h5t.MACHINE == 'ppc64el':
+            return
+
         test_filename = self.mktemp()
         dataset = 'DS1'
         dataset2 = 'DS2'
@@ -183,26 +186,26 @@ class TestTypeFloatID(TestCase):
 
         # ebias promotion to float32
         values = f[dataset][:]
-        self.assert_(np.all(values == wdata))
-        self.assert_(values.dtype == np.float32)
+        self.assertTrue(np.all(values == wdata))
+        self.assertEqual(values.dtype, np.dtype('<f4'))
 
         # esize promotion to float32
         values = f[dataset2][:]
-        self.assert_(np.all(values == wdata2))
-        self.assert_(values.dtype == np.float32)
+        self.assertTrue(np.all(values == wdata2))
+        self.assertEqual(values.dtype, np.dtype('<f4'))
 
         # regular half floats
         dset = f[dataset3]
         try:
-            self.assert_(dset.dtype == np.float16)
+            self.assertEqual(dset.dtype, np.dtype('<f2'))
         except AttributeError:
-            self.assert_(dset.dtype == np.float32)
+            self.assertEqual(dset.dtype, np.dtype('<f4'))
 
         # ebias promotion to float64
         dset = f[dataset4]
-        self.assert_(dset.dtype == np.float64)
+        self.assertEqual(dset.dtype, np.dtype('<f8'))
 
         # long double floats
 
         dset = f[dataset5]
-        self.assert_(dset.dtype == np.longdouble)
+        self.assertEqual(dset.dtype, np.longdouble)
diff --git a/h5py/version.py b/h5py/version.py
index ead9609..f5c3287 100644
--- a/h5py/version.py
+++ b/h5py/version.py
@@ -18,7 +18,7 @@ from distutils.version import StrictVersion as _sv
 import sys
 import numpy
 
-version = "2.6.0"
+version = "2.7.0rc3"
 
 _exp = _sv(version)
 
@@ -46,5 +46,3 @@ numpy   %(numpy)s
         'platform': sys.platform,
         'maxsize': sys.maxsize,
         'numpy': numpy.__version__ }
-
-
diff --git a/setup.py b/setup.py
index 9c5d516..6b88837 100755
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ import os.path as op
 import setup_build, setup_configure
 
 
-VERSION = '2.7.0rc2'
+VERSION = '2.7.0rc3'
 
 NUMPY_DEP = 'numpy>=1.7'
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list