Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit fa6d9df

Browse files
author
Ehsan Totoni
committed
make hdf5 extension optional
1 parent 153d282 commit fa6d9df

3 files changed

Lines changed: 23 additions & 19 deletions

File tree

hpat/hiframes/hiframes_untyped.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def _run_assign(self, assign, label):
227227
return self._run_call(assign, label)
228228

229229
# fix type for f['A'][:] dset reads
230-
if rhs.op in ('getitem', 'static_getitem'):
230+
if config._has_h5py and rhs.op in ('getitem', 'static_getitem'):
231231
h5_nodes = self.h5_handler.handle_possible_h5_read(
232232
assign, lhs, rhs)
233233
if h5_nodes is not None:
@@ -405,7 +405,7 @@ def _run_call(self, assign, label):
405405
return self._handle_rolling(lhs, rhs, func_mod, func_name, label)
406406

407407

408-
if fdef == ('File', 'h5py'):
408+
if config._has_h5py and fdef == ('File', 'h5py'):
409409
return self.h5_handler._handle_h5_File_call(assign, lhs, rhs)
410410

411411
if fdef == ('fromfile', 'numpy'):

hpat/io/pio_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
import hpat
1212
from hpat.utils import unliteral_all
1313
import hpat.io
14-
from hpat.io import _hdf5
15-
import llvmlite.binding as ll
16-
ll.add_symbol('hpat_h5_read_filter', _hdf5.hpat_h5_read_filter)
14+
15+
if hpat.config._has_h5py:
16+
from hpat.io import _hdf5
17+
import llvmlite.binding as ll
18+
ll.add_symbol('hpat_h5_read_filter', _hdf5.hpat_h5_read_filter)
19+
1720

1821
################## Types #######################
1922

hpat/io/pio_lower.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@
1010
from hpat.str_ext import string_type, gen_get_unicode_chars, gen_std_str_to_unicode
1111
import h5py
1212
from llvmlite import ir as lir
13-
import hpat.io
14-
from hpat.io import _hdf5
1513
import llvmlite.binding as ll
16-
ll.add_symbol('hpat_h5_open', _hdf5.hpat_h5_open)
17-
ll.add_symbol('hpat_h5_open_dset_or_group_obj', _hdf5.hpat_h5_open_dset_or_group_obj)
18-
ll.add_symbol('hpat_h5_size', _hdf5.hpat_h5_size)
19-
ll.add_symbol('hpat_h5_read', _hdf5.hpat_h5_read)
20-
ll.add_symbol('hpat_h5_get_type_enum', _hdf5.hpat_h5_get_type_enum)
21-
ll.add_symbol('hpat_h5_create_dset', _hdf5.hpat_h5_create_dset)
22-
ll.add_symbol('hpat_h5_create_group', _hdf5.hpat_h5_create_group)
23-
ll.add_symbol('hpat_h5_write', _hdf5.hpat_h5_write)
24-
ll.add_symbol('hpat_h5_close', _hdf5.hpat_h5_close)
25-
ll.add_symbol('h5g_get_num_objs', _hdf5.h5g_get_num_objs)
26-
ll.add_symbol('h5g_get_objname_by_idx', _hdf5.h5g_get_objname_by_idx)
27-
ll.add_symbol('h5g_close', _hdf5.hpat_h5g_close)
14+
import hpat.io
15+
if hpat.config._has_h5py:
16+
from hpat.io import _hdf5
17+
ll.add_symbol('hpat_h5_open', _hdf5.hpat_h5_open)
18+
ll.add_symbol('hpat_h5_open_dset_or_group_obj', _hdf5.hpat_h5_open_dset_or_group_obj)
19+
ll.add_symbol('hpat_h5_size', _hdf5.hpat_h5_size)
20+
ll.add_symbol('hpat_h5_read', _hdf5.hpat_h5_read)
21+
ll.add_symbol('hpat_h5_get_type_enum', _hdf5.hpat_h5_get_type_enum)
22+
ll.add_symbol('hpat_h5_create_dset', _hdf5.hpat_h5_create_dset)
23+
ll.add_symbol('hpat_h5_create_group', _hdf5.hpat_h5_create_group)
24+
ll.add_symbol('hpat_h5_write', _hdf5.hpat_h5_write)
25+
ll.add_symbol('hpat_h5_close', _hdf5.hpat_h5_close)
26+
ll.add_symbol('h5g_get_num_objs', _hdf5.h5g_get_num_objs)
27+
ll.add_symbol('h5g_get_objname_by_idx', _hdf5.h5g_get_objname_by_idx)
28+
ll.add_symbol('h5g_close', _hdf5.hpat_h5g_close)
2829

2930
h5file_lir_type = lir.IntType(64)
3031

0 commit comments

Comments
 (0)