Update to 3.1.0
This commit is contained in:
parent
f4ddb88d4d
commit
5b3976c080
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,3 +15,4 @@
|
||||
/h5py-2.9.0.tar.gz
|
||||
/h5py-2.10.0.tar.gz
|
||||
/h5py-3.0.0.tar.gz
|
||||
/h5py-3.1.0.tar.gz
|
||||
|
149
1730.patch
149
1730.patch
@ -1,149 +0,0 @@
|
||||
From 9110e55d9eac43803bc9af95e7bd44ecde916e4f Mon Sep 17 00:00:00 2001
|
||||
From: "Kacper Kowalik (Xarthisius)" <xarthisius.kk@gmail.com>
|
||||
Date: Sat, 31 Oct 2020 18:30:45 -0500
|
||||
Subject: [PATCH 1/3] Fix expected values in the original BE test.
|
||||
|
||||
Add a new simple test.
|
||||
---
|
||||
h5py/tests/test_big_endian_file.py | 44 ++++++++++++++++++++----------
|
||||
1 file changed, 30 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/h5py/tests/test_big_endian_file.py b/h5py/tests/test_big_endian_file.py
|
||||
index 7af322ff3..83fb92aa9 100644
|
||||
--- a/h5py/tests/test_big_endian_file.py
|
||||
+++ b/h5py/tests/test_big_endian_file.py
|
||||
@@ -1,34 +1,50 @@
|
||||
import pytest
|
||||
|
||||
+import numpy as np
|
||||
from h5py import File
|
||||
+from .common import TestCase
|
||||
from .data_files import get_data_file_path
|
||||
|
||||
|
||||
def test_vlen_big_endian():
|
||||
with File(get_data_file_path("vlen_string_s390x.h5")) as f:
|
||||
- assert f.attrs['created_on_s390x'] == 1
|
||||
+ assert f.attrs["created_on_s390x"] == 1
|
||||
|
||||
- dset = f['DSvariable']
|
||||
- assert dset[0] == b'Parting'
|
||||
- assert dset[1] == b'is such'
|
||||
- assert dset[2] == b'sweet'
|
||||
- assert dset[3] == b'sorrow...'
|
||||
+ dset = f["DSvariable"]
|
||||
+ assert dset[0] == b"Parting"
|
||||
+ assert dset[1] == b"is such"
|
||||
+ assert dset[2] == b"sweet"
|
||||
+ assert dset[3] == b"sorrow..."
|
||||
|
||||
- dset = f['DSLEfloat']
|
||||
+ dset = f["DSLEfloat"]
|
||||
assert dset[0] == 3.14
|
||||
assert dset[1] == 1.61
|
||||
assert dset[2] == 2.71
|
||||
assert dset[3] == 2.41
|
||||
assert dset[4] == 1.2
|
||||
- assert dset.dtype == '<f8'
|
||||
+ assert dset.dtype == "<f8"
|
||||
|
||||
# Same float values with big endianess
|
||||
- assert f['DSBEfloat'][0] == pytest.approx(7.9824696849641e-157)
|
||||
- assert f['DSBEfloat'].dtype == '>f8'
|
||||
+ assert f["DSBEfloat"][0] == 3.14
|
||||
+ assert f["DSBEfloat"].dtype == ">f8"
|
||||
|
||||
- assert f['DSLEint'][0] == 1
|
||||
- assert f['DSLEint'].dtype == 'uint64'
|
||||
+ assert f["DSLEint"][0] == 1
|
||||
+ assert f["DSLEint"].dtype == "uint64"
|
||||
|
||||
# Same int values with big endianess
|
||||
- assert f['DSBEint'][0] == 72057594037927936
|
||||
- assert f['DSBEint'].dtype == '>i8'
|
||||
+ assert f["DSBEint"][0] == 1
|
||||
+ assert f["DSBEint"].dtype == ">i8"
|
||||
+
|
||||
+
|
||||
+class TestEndianess(TestCase):
|
||||
+ def test_simple_int_be(self):
|
||||
+ fname = self.mktemp()
|
||||
+
|
||||
+ arr = np.ndarray(shape=(1,), dtype=">i4", buffer=bytearray([0, 1, 3, 2]))
|
||||
+ be_number = 0 * 256 ** 3 + 1 * 256 ** 2 + 3 * 256 ** 1 + 2 * 256 ** 0
|
||||
+
|
||||
+ with File(fname, mode="w") as f:
|
||||
+ f.create_dataset("int", data=arr)
|
||||
+
|
||||
+ with File(fname, mode="r") as f:
|
||||
+ assert f["int"][()][0] == be_number
|
||||
|
||||
From a8cd2cbfbd3e7b45bc1c127360c2ee7e64ae85b3 Mon Sep 17 00:00:00 2001
|
||||
From: "Kacper Kowalik (Xarthisius)" <xarthisius.kk@gmail.com>
|
||||
Date: Sat, 31 Oct 2020 18:34:25 -0500
|
||||
Subject: [PATCH 2/3] Preserve the endianess in Reader. Fixes #1729
|
||||
|
||||
---
|
||||
h5py/_selector.pyx | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/h5py/_selector.pyx b/h5py/_selector.pyx
|
||||
index 1b06e75e6..9b19a4210 100644
|
||||
--- a/h5py/_selector.pyx
|
||||
+++ b/h5py/_selector.pyx
|
||||
@@ -19,6 +19,8 @@ from .h5s cimport SpaceID
|
||||
from .h5t cimport TypeID, typewrap, py_create
|
||||
from .utils cimport emalloc, efree, convert_dims
|
||||
|
||||
+import sys
|
||||
+
|
||||
import_array()
|
||||
|
||||
|
||||
@@ -293,6 +295,7 @@ cdef class Reader:
|
||||
cdef Selector selector
|
||||
cdef TypeID h5_memory_datatype
|
||||
cdef int np_typenum
|
||||
+ cdef char np_byteorder
|
||||
|
||||
def __cinit__(self, DatasetID dsid):
|
||||
self.dataset = dsid.id
|
||||
@@ -305,6 +308,7 @@ cdef class Reader:
|
||||
h5_stored_datatype = typewrap(H5Dget_type(self.dataset))
|
||||
np_dtype = h5_stored_datatype.py_dtype()
|
||||
self.np_typenum = np_dtype.num
|
||||
+ self.np_byteorder = np_dtype.byteorder
|
||||
self.h5_memory_datatype = py_create(np_dtype)
|
||||
|
||||
cdef ndarray make_array(self, hsize_t* mshape):
|
||||
@@ -325,6 +329,8 @@ cdef class Reader:
|
||||
arr_rank += 1
|
||||
|
||||
arr = PyArray_SimpleNew(arr_rank, arr_shape, self.np_typenum)
|
||||
+ if self.np_byteorder == (sys.byteorder == 'little' and '>' or '<'):
|
||||
+ arr = arr.byteswap().newbyteorder()
|
||||
finally:
|
||||
efree(arr_shape)
|
||||
|
||||
|
||||
From a79e616a6cdcae55b82046b7461b90fbda393ee0 Mon Sep 17 00:00:00 2001
|
||||
From: "Kacper Kowalik (Xarthisius)" <xarthisius.kk@gmail.com>
|
||||
Date: Sat, 31 Oct 2020 18:50:24 -0500
|
||||
Subject: [PATCH 3/3] Add info about bugfix in news and update .authors
|
||||
|
||||
---
|
||||
.authors.yml | 7 +++++++
|
||||
news/fix_be_fastread.rst | 4 ++++
|
||||
2 files changed, 11 insertions(+)
|
||||
create mode 100644 news/fix_be_fastread.rst
|
||||
|
||||
diff --git a/news/fix_be_fastread.rst b/news/fix_be_fastread.rst
|
||||
new file mode 100644
|
||||
index 000000000..64dfc41e2
|
||||
--- /dev/null
|
||||
+++ b/news/fix_be_fastread.rst
|
||||
@@ -0,0 +1,4 @@
|
||||
+Bug fixes
|
||||
+---------
|
||||
+
|
||||
+* Preserve endianess in Cython dataset Reader (:issue:`1729`).
|
68
1741.patch
68
1741.patch
@ -1,68 +0,0 @@
|
||||
From f0c708b0f008ff14e1127e0b833e30f2acf17228 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Kluyver <thomas@kluyver.me.uk>
|
||||
Date: Wed, 4 Nov 2020 12:45:07 +0000
|
||||
Subject: [PATCH 1/2] Fix test of little-endian dtype for big-endian systems
|
||||
|
||||
---
|
||||
h5py/tests/test_big_endian_file.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/h5py/tests/test_big_endian_file.py b/h5py/tests/test_big_endian_file.py
|
||||
index 83fb92aa9..4d81de01a 100644
|
||||
--- a/h5py/tests/test_big_endian_file.py
|
||||
+++ b/h5py/tests/test_big_endian_file.py
|
||||
@@ -29,7 +29,7 @@ def test_vlen_big_endian():
|
||||
assert f["DSBEfloat"].dtype == ">f8"
|
||||
|
||||
assert f["DSLEint"][0] == 1
|
||||
- assert f["DSLEint"].dtype == "uint64"
|
||||
+ assert f["DSLEint"].dtype == "<u8"
|
||||
|
||||
# Same int values with big endianess
|
||||
assert f["DSBEint"][0] == 1
|
||||
|
||||
From aff4cd536ba6042e023142af140c893536245606 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Kluyver <thomas@kluyver.me.uk>
|
||||
Date: Wed, 4 Nov 2020 15:08:10 +0000
|
||||
Subject: [PATCH 2/2] Add news entry for test fix
|
||||
|
||||
---
|
||||
news/test-endian-dtype.rst | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
create mode 100644 news/test-endian-dtype.rst
|
||||
|
||||
diff --git a/news/test-endian-dtype.rst b/news/test-endian-dtype.rst
|
||||
new file mode 100644
|
||||
index 000000000..9efd927d7
|
||||
--- /dev/null
|
||||
+++ b/news/test-endian-dtype.rst
|
||||
@@ -0,0 +1,29 @@
|
||||
+New features
|
||||
+------------
|
||||
+
|
||||
+* <news item>
|
||||
+
|
||||
+Deprecations
|
||||
+------------
|
||||
+
|
||||
+* <news item>
|
||||
+
|
||||
+Exposing HDF5 functions
|
||||
+-----------------------
|
||||
+
|
||||
+* <news item>
|
||||
+
|
||||
+Bug fixes
|
||||
+---------
|
||||
+
|
||||
+* <news item>
|
||||
+
|
||||
+Building h5py
|
||||
+-------------
|
||||
+
|
||||
+* <news item>
|
||||
+
|
||||
+Development
|
||||
+-----------
|
||||
+
|
||||
+* Fix a test which was failing on big-endian systems.
|
@ -1,69 +0,0 @@
|
||||
diff --git a/lzf/lzf_filter.c b/lzf/lzf_filter.c
|
||||
index 951b1e4c..67c2b95a 100644
|
||||
--- a/lzf/lzf_filter.c
|
||||
+++ b/lzf/lzf_filter.c
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "hdf5.h"
|
||||
-#include "lzf/lzf.h"
|
||||
+#include "lzf.h"
|
||||
#include "lzf_filter.h"
|
||||
|
||||
/* Our own versions of H5Epush_sim, as it changed in 1.8 */
|
||||
diff --git a/news/system_lzf.rst b/news/system_lzf.rst
|
||||
new file mode 100644
|
||||
index 00000000..3ec5f6ea
|
||||
--- /dev/null
|
||||
+++ b/news/system_lzf.rst
|
||||
@@ -0,0 +1,4 @@
|
||||
+Building h5py
|
||||
+-------------
|
||||
+
|
||||
+* Allow building against system lzf library by setting H5PY_SYSTEM_LZF=1
|
||||
diff --git a/setup_build.py b/setup_build.py
|
||||
index 03c47fa0..3c7c7adb 100644
|
||||
--- a/setup_build.py
|
||||
+++ b/setup_build.py
|
||||
@@ -33,10 +33,6 @@ MODULES = ['defs', '_errors', '_objects', '_proxy', 'h5fd', 'h5z',
|
||||
'h5ds', 'h5ac',
|
||||
'h5pl']
|
||||
|
||||
-EXTRA_SRC = {'h5z': [ localpath("lzf/lzf_filter.c"),
|
||||
- localpath("lzf/lzf/lzf_c.c"),
|
||||
- localpath("lzf/lzf/lzf_d.c")]}
|
||||
-
|
||||
COMPILER_SETTINGS = {
|
||||
'libraries' : ['hdf5', 'hdf5_hl'],
|
||||
'include_dirs' : [localpath('lzf')],
|
||||
@@ -46,6 +42,22 @@ COMPILER_SETTINGS = {
|
||||
]
|
||||
}
|
||||
|
||||
+EXTRA_SRC = {'h5z': [ localpath("lzf/lzf_filter.c") ]}
|
||||
+
|
||||
+# Set the environment variable H5PY_SYSTEM_LZF=1 if we want to
|
||||
+# use the system lzf library
|
||||
+if os.environ.get('H5PY_SYSTEM_LZF', '0') == '1':
|
||||
+ EXTRA_LIBRARIES = {
|
||||
+ 'h5z': [ 'lzf' ]
|
||||
+ }
|
||||
+else:
|
||||
+ COMPILER_SETTINGS['include_dirs'] += [localpath('lzf/lzf')]
|
||||
+
|
||||
+ EXTRA_SRC['h5z'] += [localpath("lzf/lzf/lzf_c.c"),
|
||||
+ localpath("lzf/lzf/lzf_d.c")]
|
||||
+
|
||||
+ EXTRA_LIBRARIES = {}
|
||||
+
|
||||
if sys.platform.startswith('win'):
|
||||
COMPILER_SETTINGS['include_dirs'].append(localpath('windows'))
|
||||
COMPILER_SETTINGS['define_macros'].extend([
|
||||
@@ -98,6 +110,7 @@ class h5py_build_ext(build_ext):
|
||||
|
||||
def make_extension(module):
|
||||
sources = [localpath('h5py', module + '.pyx')] + EXTRA_SRC.get(module, [])
|
||||
+ settings['libraries'] += EXTRA_LIBRARIES.get(module, [])
|
||||
return Extension('h5py.' + module, sources, **settings)
|
||||
|
||||
return [make_extension(m) for m in MODULES]
|
17
h5py.spec
17
h5py.spec
@ -3,18 +3,11 @@
|
||||
|
||||
Summary: A Python interface to the HDF5 library
|
||||
Name: h5py
|
||||
Version: 3.0.0
|
||||
Version: 3.1.0
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
URL: http://www.h5py.org/
|
||||
Source0: https://files.pythonhosted.org/packages/source/h/h5py/h5py-%{version}.tar.gz
|
||||
# patch to use a system liblzf rather than bundled liblzf
|
||||
# https://github.com/h5py/h5py/pull/1697
|
||||
Patch0: h5py-system-lzf.patch
|
||||
# Fix big-endian
|
||||
Patch1: https://patch-diff.githubusercontent.com/raw/h5py/h5py/pull/1730.patch
|
||||
Patch2: https://patch-diff.githubusercontent.com/raw/h5py/h5py/pull/1741.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: hdf5-devel
|
||||
BuildRequires: liblzf-devel
|
||||
@ -84,11 +77,6 @@ Requires: mpich
|
||||
%setup -q -c -n %{name}-%{version}
|
||||
mv %{name}-%{version} serial
|
||||
cd serial
|
||||
# use system libzlf and remove private copy
|
||||
%patch0 -p1 -b .lzf
|
||||
%patch1 -p1 -b .big-endian
|
||||
%patch2 -p1 -b .big-endian
|
||||
rm -r lzf/lzf
|
||||
%{__python3} api_gen.py
|
||||
cd -
|
||||
for x in mpich openmpi
|
||||
@ -208,6 +196,9 @@ mpirun %{__python3} -m pytest --pyargs h5py -rxXs --with-mpi ${PYTHONPATH} || ex
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Nov 07 2020 Terje Rosten <terje.rosten@ntnu.no> - 3.1.0-1
|
||||
- Update to 3.1.0
|
||||
|
||||
* Fri Oct 30 2020 Orion Poplawski <orion@nwra.com> - 3.0.0-1
|
||||
- Update to 3.0.0
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (h5py-3.0.0.tar.gz) = 31b604d472dd35e0a4abf30e9d05a3cfeb27cf5fd2b1b1bb682fd37ae7faf486f6b476213dee9e8f4ce9eb6bdb932e2fb1ac1be84870c87249691d0b33843082
|
||||
SHA512 (h5py-3.1.0.tar.gz) = cc01a326e2e12a976834c26f06aceaeb42eae655d3b3150827e15645aee84402523e11ae8b72636af46ce4895ba0f846cdfbcd979668660bbcca3f18c73b7817
|
||||
|
Loading…
Reference in New Issue
Block a user