def register_plugin(): plugin_path = pkg_resources.resource_filename('ont_fast5_api', 'vbz_plugin') try: from h5py import h5pl h5pl.prepend(bytes(plugin_path, 'UTF-8')) except ImportError: # We don't have the plugin library in h5py<2.10 so we fall back on an environment variable import os os.environ['HDF5_PLUGIN_PATH'] = plugin_path return plugin_path
def register_plugin(): plugin_path = pkg_resources.resource_filename('ont_fast5_api', 'vbz_plugin') try: from h5py import h5pl if sys.version_info.major == 2: # TODO we can remove this when we drop python2 support h5pl.prepend(bytes(plugin_path)) else: h5pl.prepend(bytes(plugin_path, 'UTF-8')) except ImportError: # We don't have the plugin library in h5py<2.10 so we fall back on an environment variable import os os.environ['HDF5_PLUGIN_PATH'] = plugin_path return plugin_path
def test_prepend(request): h5pl.prepend(b'/opt/hdf5/vendor-plugin') assert h5pl.size() == 2 assert h5pl.get(0) == b'/opt/hdf5/vendor-plugin' assert h5pl.get(1) == b'h5py_plugin_test'