1 |
commit: e0e02abb64e2a95d94baff5bf8a3fac1f5878a95 |
2 |
Author: Horea Christian <chr <AT> chymera <DOT> eu> |
3 |
AuthorDate: Mon Jan 30 11:42:48 2023 +0000 |
4 |
Commit: Horea Christian <horea.christ <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Jan 30 11:42:48 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=e0e02abb |
7 |
|
8 |
dev-python/hdmf: add 3.4.7, 3.5.0_p1, 3.5.1 |
9 |
|
10 |
Signed-off-by: Horea Christian <chr <AT> chymera.eu> |
11 |
|
12 |
dev-python/hdmf/files/hdmf-3.5.0-open_links.patch | 170 ++++++++++++++++++++++ |
13 |
dev-python/hdmf/hdmf-3.4.7.ebuild | 32 ++++ |
14 |
dev-python/hdmf/hdmf-3.5.0_p1.ebuild | 37 +++++ |
15 |
dev-python/hdmf/hdmf-3.5.1.ebuild | 32 ++++ |
16 |
4 files changed, 271 insertions(+) |
17 |
|
18 |
diff --git a/dev-python/hdmf/files/hdmf-3.5.0-open_links.patch b/dev-python/hdmf/files/hdmf-3.5.0-open_links.patch |
19 |
new file mode 100644 |
20 |
index 000000000..544bf8f4b |
21 |
--- /dev/null |
22 |
+++ b/dev-python/hdmf/files/hdmf-3.5.0-open_links.patch |
23 |
@@ -0,0 +1,170 @@ |
24 |
+From 184b4a6711c60d90e073828ddcd3a6d328ee6a5e Mon Sep 17 00:00:00 2001 |
25 |
+From: Oliver Ruebel <oruebel@×××.gov> |
26 |
+Date: Wed, 18 Jan 2023 16:05:57 -0800 |
27 |
+Subject: [PATCH 1/5] Fix #817 Check that __open_links exists before trying to |
28 |
+ clsoe links |
29 |
+ |
30 |
+--- |
31 |
+ src/hdmf/backends/hdf5/h5tools.py | 13 +++++++++---- |
32 |
+ 1 file changed, 9 insertions(+), 4 deletions(-) |
33 |
+ |
34 |
+diff --git a/src/hdmf/backends/hdf5/h5tools.py b/src/hdmf/backends/hdf5/h5tools.py |
35 |
+index ba8946c60..acf2061ad 100644 |
36 |
+--- a/src/hdmf/backends/hdf5/h5tools.py |
37 |
++++ b/src/hdmf/backends/hdf5/h5tools.py |
38 |
+@@ -746,10 +746,15 @@ def close_linked_files(self): |
39 |
+ not, which prevents the linked-to file from being deleted or truncated. Use this method to close all opened, |
40 |
+ linked-to files. |
41 |
+ """ |
42 |
+- for obj in self.__open_links: |
43 |
+- if obj: |
44 |
+- obj.file.close() |
45 |
+- self.__open_links = [] |
46 |
++ # Make sure |
47 |
++ try: |
48 |
++ for obj in self.__open_links: |
49 |
++ if obj: |
50 |
++ obj.file.close() |
51 |
++ except AttributeError: # In case that self.__open_links does not exist on delete |
52 |
++ pass |
53 |
++ finally: |
54 |
++ self.__open_links = [] |
55 |
+ |
56 |
+ @docval({'name': 'builder', 'type': GroupBuilder, 'doc': 'the GroupBuilder object representing the HDF5 file'}, |
57 |
+ {'name': 'link_data', 'type': bool, |
58 |
+ |
59 |
+From c12ea0851f4632c59ecdd626556bee6ddc22b632 Mon Sep 17 00:00:00 2001 |
60 |
+From: Oliver Ruebel <oruebel@×××.gov> |
61 |
+Date: Wed, 18 Jan 2023 17:32:20 -0800 |
62 |
+Subject: [PATCH 2/5] Catch possible missing HDF5IO.__file error |
63 |
+ |
64 |
+--- |
65 |
+ src/hdmf/backends/hdf5/h5tools.py | 19 +++++++++++++++---- |
66 |
+ 1 file changed, 15 insertions(+), 4 deletions(-) |
67 |
+ |
68 |
+diff --git a/src/hdmf/backends/hdf5/h5tools.py b/src/hdmf/backends/hdf5/h5tools.py |
69 |
+index acf2061ad..75044a64a 100644 |
70 |
+--- a/src/hdmf/backends/hdf5/h5tools.py |
71 |
++++ b/src/hdmf/backends/hdf5/h5tools.py |
72 |
+@@ -736,8 +736,15 @@ def close(self, close_links=True): |
73 |
+ """ |
74 |
+ if close_links: |
75 |
+ self.close_linked_files() |
76 |
+- if self.__file is not None: |
77 |
+- self.__file.close() |
78 |
++ try: |
79 |
++ if self.__file is not None: |
80 |
++ self.__file.close() |
81 |
++ except AttributeError: |
82 |
++ # Do not do anything in case that self._file does not exist. This |
83 |
++ # may happen in case that an error occurs before HDF5IO has been fully |
84 |
++ # setup in __init__, e.g,. if a child class such as NWBHDF5IO raises |
85 |
++ # and error before self.__file has been created |
86 |
++ warnings.warn("HDF5IO was not fully initialized before close. Missing self.__file") |
87 |
+ |
88 |
+ def close_linked_files(self): |
89 |
+ """Close all opened, linked-to files. |
90 |
+@@ -751,8 +758,12 @@ def close_linked_files(self): |
91 |
+ for obj in self.__open_links: |
92 |
+ if obj: |
93 |
+ obj.file.close() |
94 |
+- except AttributeError: # In case that self.__open_links does not exist on delete |
95 |
+- pass |
96 |
++ except AttributeError: |
97 |
++ # Do not do anything in case that self.__open_links does not exist. This |
98 |
++ # may happen in case that an error occurs before HDF5IO has been fully |
99 |
++ # setup in __init__, e.g,. if a child class such as NWBHDF5IO raises |
100 |
++ # and error before self.__open_links has been created. |
101 |
++ warnings.warn("HDF5IO was not fully initialized before close. Missing self.__open_links.") |
102 |
+ finally: |
103 |
+ self.__open_links = [] |
104 |
+ |
105 |
+ |
106 |
+From a43e65d13726936aa2ab49169e265a42c5a1be7f Mon Sep 17 00:00:00 2001 |
107 |
+From: Oliver Ruebel <oruebel@×××.gov> |
108 |
+Date: Wed, 18 Jan 2023 17:32:55 -0800 |
109 |
+Subject: [PATCH 3/5] Add unit test for case where HDF5IO.close is called |
110 |
+ before HDF5IO.__init__ is complete |
111 |
+ |
112 |
+--- |
113 |
+ tests/unit/test_io_hdf5_h5tools.py | 34 ++++++++++++++++++++++++++++++ |
114 |
+ 1 file changed, 34 insertions(+) |
115 |
+ |
116 |
+diff --git a/tests/unit/test_io_hdf5_h5tools.py b/tests/unit/test_io_hdf5_h5tools.py |
117 |
+index 8c03e72f8..0f2f81e31 100644 |
118 |
+--- a/tests/unit/test_io_hdf5_h5tools.py |
119 |
++++ b/tests/unit/test_io_hdf5_h5tools.py |
120 |
+@@ -826,6 +826,40 @@ def test_constructor(self): |
121 |
+ self.assertEqual(io.manager, self.manager) |
122 |
+ self.assertEqual(io.source, self.path) |
123 |
+ |
124 |
++ def test_delete_with_incomplete_construction_missing_file(self): |
125 |
++ """ |
126 |
++ Here we test what happens when close is called before HDF5IO.__init__ has |
127 |
++ bee completed. In this case self.__file is missing |
128 |
++ """ |
129 |
++ class MyHDF5IO(HDF5IO): |
130 |
++ def __init__(self): |
131 |
++ raise ValueError("test error") |
132 |
++ with self.assertWarnsWith(warn_type=UserWarning, |
133 |
++ exc_msg="HDF5IO was not fully initialized before close. Missing self.__file"): |
134 |
++ try: |
135 |
++ with MyHDF5IO() as _: |
136 |
++ pass |
137 |
++ except ValueError: |
138 |
++ pass |
139 |
++ |
140 |
++ def test_delete_with_incomplete_construction_missing_open_files(self): |
141 |
++ """ |
142 |
++ Here we test what happens when close is called before HDF5IO.__init__ has |
143 |
++ bee completed. In this case self.__open_file is missing |
144 |
++ """ |
145 |
++ |
146 |
++ class MyHDF5IO(HDF5IO): |
147 |
++ def __init__(self): |
148 |
++ raise ValueError("test error") |
149 |
++ |
150 |
++ with self.assertWarnsWith(warn_type=UserWarning, |
151 |
++ exc_msg="HDF5IO was not fully initialized before close. Missing self.__open_links."): |
152 |
++ try: |
153 |
++ with MyHDF5IO() as _: |
154 |
++ pass |
155 |
++ except ValueError: |
156 |
++ pass |
157 |
++ |
158 |
+ def test_set_file_mismatch(self): |
159 |
+ self.file_obj = File(get_temp_filepath(), 'w') |
160 |
+ err_msg = ("You argued %s as this object's path, but supplied a file with filename: %s" |
161 |
+ |
162 |
+From f79b3a26bdfaee22b8d24bd3094c93be77e5595f Mon Sep 17 00:00:00 2001 |
163 |
+From: Oliver Ruebel <oruebel@×××.gov> |
164 |
+Date: Thu, 19 Jan 2023 13:54:33 -0800 |
165 |
+Subject: [PATCH 5/5] Move init of __file and __openlink up to prevent warning |
166 |
+ during close |
167 |
+ |
168 |
+--- |
169 |
+ src/hdmf/backends/hdf5/h5tools.py | 4 +++- |
170 |
+ 1 file changed, 3 insertions(+), 1 deletion(-) |
171 |
+ |
172 |
+diff --git a/src/hdmf/backends/hdf5/h5tools.py b/src/hdmf/backends/hdf5/h5tools.py |
173 |
+index 75044a64a..44b9c612c 100644 |
174 |
+--- a/src/hdmf/backends/hdf5/h5tools.py |
175 |
++++ b/src/hdmf/backends/hdf5/h5tools.py |
176 |
+@@ -55,6 +55,9 @@ def __init__(self, **kwargs): |
177 |
+ path, manager, mode, comm, file_obj, driver = popargs('path', 'manager', 'mode', 'comm', 'file', 'driver', |
178 |
+ kwargs) |
179 |
+ |
180 |
++ self.__open_links = [] # keep track of other files opened from links in this file |
181 |
++ self.__file = None # This will be set below, but set to None first in case an error occurs and we need to close |
182 |
++ |
183 |
+ if path is None and file_obj is None: |
184 |
+ raise ValueError("You must supply either a path or a file.") |
185 |
+ |
186 |
+@@ -89,7 +92,6 @@ def __init__(self, **kwargs): |
187 |
+ self.__dci_queue = HDF5IODataChunkIteratorQueue() # a queue of DataChunkIterators that need to be exhausted |
188 |
+ ObjectMapper.no_convert(Dataset) |
189 |
+ self._written_builders = WriteStatusTracker() # track which builders were written (or read) by this IO object |
190 |
+- self.__open_links = [] # keep track of other files opened from links in this file |
191 |
+ |
192 |
+ @property |
193 |
+ def comm(self): |
194 |
|
195 |
diff --git a/dev-python/hdmf/hdmf-3.4.7.ebuild b/dev-python/hdmf/hdmf-3.4.7.ebuild |
196 |
new file mode 100644 |
197 |
index 000000000..4e9d47921 |
198 |
--- /dev/null |
199 |
+++ b/dev-python/hdmf/hdmf-3.4.7.ebuild |
200 |
@@ -0,0 +1,32 @@ |
201 |
+# Copyright 1999-2023 Gentoo Authors |
202 |
+# Distributed under the terms of the GNU General Public License v2 |
203 |
+ |
204 |
+EAPI=8 |
205 |
+ |
206 |
+DISTUTILS_USE_PEP517=setuptools |
207 |
+PYTHON_COMPAT=( python3_10 ) |
208 |
+inherit distutils-r1 |
209 |
+ |
210 |
+DESCRIPTION="The Hierarchical Data Modeling Framework" |
211 |
+HOMEPAGE="https://github.com/hdmf-dev/hdmf" |
212 |
+SRC_URI="https://github.com/hdmf-dev/hdmf/releases/download/${PV}/${P}.tar.gz" |
213 |
+ |
214 |
+SLOT="0" |
215 |
+LICENSE="BSD" |
216 |
+KEYWORDS="~amd64 ~x86" |
217 |
+ |
218 |
+RDEPEND=" |
219 |
+ dev-python/h5py[${PYTHON_USEDEP}] |
220 |
+ dev-python/jsonschema[${PYTHON_USEDEP}] |
221 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
222 |
+ dev-python/pandas[${PYTHON_USEDEP}] |
223 |
+ dev-python/ruamel-yaml[${PYTHON_USEDEP}] |
224 |
+ dev-python/scipy[${PYTHON_USEDEP}] |
225 |
+ " |
226 |
+BDEPEND="" |
227 |
+ |
228 |
+#PATCHES=( |
229 |
+# "${FILESDIR}/${P}-versions.patch" |
230 |
+#) |
231 |
+ |
232 |
+distutils_enable_tests pytest |
233 |
|
234 |
diff --git a/dev-python/hdmf/hdmf-3.5.0_p1.ebuild b/dev-python/hdmf/hdmf-3.5.0_p1.ebuild |
235 |
new file mode 100644 |
236 |
index 000000000..6e63271cd |
237 |
--- /dev/null |
238 |
+++ b/dev-python/hdmf/hdmf-3.5.0_p1.ebuild |
239 |
@@ -0,0 +1,37 @@ |
240 |
+# Copyright 1999-2023 Gentoo Authors |
241 |
+# Distributed under the terms of the GNU General Public License v2 |
242 |
+ |
243 |
+EAPI=8 |
244 |
+ |
245 |
+DISTUTILS_USE_PEP517=setuptools |
246 |
+PYTHON_COMPAT=( python3_10 ) |
247 |
+inherit distutils-r1 |
248 |
+ |
249 |
+MY_PV="${PV//_p*/}" |
250 |
+MY_P="${PN}-${MY_PV}" |
251 |
+ |
252 |
+DESCRIPTION="The Hierarchical Data Modeling Framework" |
253 |
+HOMEPAGE="https://github.com/hdmf-dev/hdmf" |
254 |
+SRC_URI="https://github.com/hdmf-dev/hdmf/releases/download/${MY_PV}/${MY_P}.tar.gz" |
255 |
+ |
256 |
+SLOT="0" |
257 |
+LICENSE="BSD" |
258 |
+KEYWORDS="~amd64 ~x86" |
259 |
+ |
260 |
+RDEPEND=" |
261 |
+ dev-python/h5py[${PYTHON_USEDEP}] |
262 |
+ dev-python/jsonschema[${PYTHON_USEDEP}] |
263 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
264 |
+ dev-python/pandas[${PYTHON_USEDEP}] |
265 |
+ dev-python/ruamel-yaml[${PYTHON_USEDEP}] |
266 |
+ dev-python/scipy[${PYTHON_USEDEP}] |
267 |
+ " |
268 |
+BDEPEND="" |
269 |
+ |
270 |
+PATCHES=( |
271 |
+ "${FILESDIR}/${MY_P}-open_links.patch" |
272 |
+) |
273 |
+ |
274 |
+distutils_enable_tests pytest |
275 |
+ |
276 |
+S="${WORKDIR}/${MY_P}" |
277 |
|
278 |
diff --git a/dev-python/hdmf/hdmf-3.5.1.ebuild b/dev-python/hdmf/hdmf-3.5.1.ebuild |
279 |
new file mode 100644 |
280 |
index 000000000..4e9d47921 |
281 |
--- /dev/null |
282 |
+++ b/dev-python/hdmf/hdmf-3.5.1.ebuild |
283 |
@@ -0,0 +1,32 @@ |
284 |
+# Copyright 1999-2023 Gentoo Authors |
285 |
+# Distributed under the terms of the GNU General Public License v2 |
286 |
+ |
287 |
+EAPI=8 |
288 |
+ |
289 |
+DISTUTILS_USE_PEP517=setuptools |
290 |
+PYTHON_COMPAT=( python3_10 ) |
291 |
+inherit distutils-r1 |
292 |
+ |
293 |
+DESCRIPTION="The Hierarchical Data Modeling Framework" |
294 |
+HOMEPAGE="https://github.com/hdmf-dev/hdmf" |
295 |
+SRC_URI="https://github.com/hdmf-dev/hdmf/releases/download/${PV}/${P}.tar.gz" |
296 |
+ |
297 |
+SLOT="0" |
298 |
+LICENSE="BSD" |
299 |
+KEYWORDS="~amd64 ~x86" |
300 |
+ |
301 |
+RDEPEND=" |
302 |
+ dev-python/h5py[${PYTHON_USEDEP}] |
303 |
+ dev-python/jsonschema[${PYTHON_USEDEP}] |
304 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
305 |
+ dev-python/pandas[${PYTHON_USEDEP}] |
306 |
+ dev-python/ruamel-yaml[${PYTHON_USEDEP}] |
307 |
+ dev-python/scipy[${PYTHON_USEDEP}] |
308 |
+ " |
309 |
+BDEPEND="" |
310 |
+ |
311 |
+#PATCHES=( |
312 |
+# "${FILESDIR}/${P}-versions.patch" |
313 |
+#) |
314 |
+ |
315 |
+distutils_enable_tests pytest |