Skip to content

Commit bae6e2c

Browse files
authored
Merge pull request #1448 from Unidata/plugin_fix1
fix inverted conditions for plugin detection
2 parents a877d6f + f05967c commit bae6e2c

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

.github/workflows/miniconda.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
4646
- name: Tests
4747
run: |
48+
#export NO_PLUGINS=YES
49+
export HDF5_PLUGIN_PATH="${CONDA_PREFIX}/hdf5/lib/plugin/"
4850
pytest -s -rxs -v test
4951
5052
run-mpi:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ test-command = [
122122
]
123123
manylinux-x86_64-image = "ghcr.io/ocefpaf/manylinux_2_28_x86_64-netcdf"
124124
manylinux-aarch64-image = "ghcr.io/ocefpaf/manylinux_2_28_aarch64-netcdf"
125-
environment = {NETCDF4_LIMITED_API="1"}
125+
environment = {NETCDF4_LIMITED_API="1", NETCDF_PLUGIN_DIR="/usr/local/hdf5/lib/plugin/"}
126126

127127
[tool.cibuildwheel.macos]
128128
before-build = "brew install hdf5 netcdf"

src/netCDF4/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# init for netCDF4. package
2+
# if HDF5_PLUGIN_PATH not set, point to package path if plugins live there
3+
import os
4+
pluginpath = os.path.join(__path__[0],'plugins')
5+
if 'HDF5_PLUGIN_PATH' not in os.environ and\
6+
(os.path.exists(os.path.join(pluginpath,'lib__nczhdf5filters.so')) or\
7+
os.path.exists(os.path.join(pluginpath,'__nczhdf5filters.dll')) or\
8+
os.path.exists(os.path.join(pluginpath,'lib__nczhdf5filters.dylib'))):
9+
os.environ['HDF5_PLUGIN_PATH']=pluginpath
210
# Docstring comes from extension module _netCDF4.
311
from ._netCDF4 import *
412
# Need explicit imports for names beginning with underscores
@@ -11,17 +19,10 @@
1119
__has_quantization_support__, __has_zstandard_support__,
1220
__has_bzip2_support__, __has_blosc_support__, __has_szip_support__,
1321
__has_set_alignment__, __has_parallel_support__, __has_ncfilter__, __has_nc_rc_set__)
14-
import os
1522
__all__ = [
1623
'Dataset', 'Variable', 'Dimension', 'Group', 'MFDataset', 'MFTime', 'CompoundType',
1724
'VLType', 'date2num', 'num2date', 'date2index', 'stringtochar', 'chartostring',
1825
'stringtoarr', 'getlibversion', 'EnumType', 'get_chunk_cache', 'set_chunk_cache',
1926
'set_alignment', 'get_alignment', 'rc_get', 'rc_set',
2027
]
2128
__pdoc__ = {'utils': False}
22-
# if HDF5_PLUGIN_PATH not set, point to package path if plugins live there
23-
pluginpath = os.path.join(__path__[0],'plugins')
24-
if 'HDF5_PLUGIN_PATH' not in os.environ and\
25-
(os.path.exists(os.path.join(pluginpath,'lib__nczhdf5filters.so')) or\
26-
os.path.exists(os.path.join(pluginpath,'lib__nczhdf5filters.dylib'))):
27-
os.environ['HDF5_PLUGIN_PATH']=pluginpath

src/netCDF4/_netCDF4.pyx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,8 +3558,11 @@ to be installed and in `$PATH`.
35583558
"""**`has_blosc_filter(self)`**
35593559
returns True if blosc compression filter is available
35603560
"""
3561-
if __has_blosc_support__:
3562-
return False
3561+
3562+
#if __has_blosc_support__:
3563+
# return True
3564+
#else:
3565+
# return False
35633566

35643567
cdef int ierr
35653568
with nogil:
@@ -3571,8 +3574,10 @@ to be installed and in `$PATH`.
35713574
returns True if zstd compression filter is available
35723575
"""
35733576

3574-
if __has_zstandard_support__:
3575-
return False
3577+
#if __has_zstandard_support__:
3578+
# return True
3579+
#else:
3580+
# return False
35763581

35773582
cdef int ierr
35783583
with nogil:
@@ -3584,8 +3589,10 @@ to be installed and in `$PATH`.
35843589
returns True if bzip2 compression filter is available
35853590
"""
35863591

3587-
if __has_bzip2_support__:
3588-
return False
3592+
#if __has_bzip2_support__:
3593+
# return True
3594+
#else:
3595+
# return False
35893596

35903597
cdef int ierr
35913598
with nogil:
@@ -3597,11 +3604,13 @@ to be installed and in `$PATH`.
35973604
returns True if szip compression filter is available
35983605
"""
35993606

3600-
if not __has_ncfilter__:
3601-
return __has_szip_support__
3607+
#if not __has_ncfilter__:
3608+
# return __has_szip_support__
36023609

3603-
if not __has_szip_support__:
3604-
return False
3610+
#if __has_szip_support__:
3611+
# return True
3612+
#else:
3613+
# return False
36053614

36063615
cdef int ierr
36073616
with nogil:

test/run_all.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
m = __import__(os.path.splitext(f)[0])
1616
testsuite.addTests(unittest.TestLoader().loadTestsFromModule(m))
1717

18-
1918
if __name__ == '__main__':
2019
import numpy, cython
2120
sys.stdout.write('\n')

0 commit comments

Comments
 (0)