netcdf-c: refactor fsync variant (#23477)

Simplify logic by just enabling or disabling fsync as user specified
(default to off currently).  Also remove the 4.1 version check, since
that version isn't actually supported in here.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
sebrowne 2021-05-14 00:59:43 -06:00 committed by GitHub
parent f47066967b
commit 19c7188cbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,7 +67,7 @@ def url_for_version(self, version):
variant('shared', default=True, description='Enable shared library') variant('shared', default=True, description='Enable shared library')
variant('dap', default=False, description='Enable DAP support') variant('dap', default=False, description='Enable DAP support')
variant('jna', default=False, description='Enable JNA support') variant('jna', default=False, description='Enable JNA support')
variant('enable-fsync', default=False, description='Enable fsync support') variant('fsync', default=False, description='Enable fsync support')
# It's unclear if cdmremote can be enabled if '--enable-netcdf-4' is passed # It's unclear if cdmremote can be enabled if '--enable-netcdf-4' is passed
# to the configure script. Since netcdf-4 support is mandatory we comment # to the configure script. Since netcdf-4 support is mandatory we comment
@ -141,9 +141,7 @@ def configure_args(self):
'--enable-largefile', '--enable-largefile',
'--enable-netcdf-4'] '--enable-netcdf-4']
# The flag was introduced in version 4.1.0 config_args.extend(self.enable_or_disable('fsync'))
if self.spec.satisfies('@4.1:'):
config_args.append('--enable-fsync')
# The flag was introduced in version 4.3.1 # The flag was introduced in version 4.3.1
if self.spec.satisfies('@4.3.1:'): if self.spec.satisfies('@4.3.1:'):
@ -189,12 +187,6 @@ def configure_args(self):
if hdf5_hl.satisfies('~shared'): if hdf5_hl.satisfies('~shared'):
libs.append(hdf5_hl.libs.link_flags) libs.append(hdf5_hl.libs.link_flags)
if '+enable-fsync' in self.spec:
# The flag was introduced in version 4.1.0. It was default
# `on` until 4.3.0 when it now defaults to `off`.
if self.spec.satisfies('@4.1:'):
config_args.append('--enable-fsync')
if '+parallel-netcdf' in self.spec: if '+parallel-netcdf' in self.spec:
config_args.append('--enable-pnetcdf') config_args.append('--enable-pnetcdf')
pnetcdf = self.spec['parallel-netcdf'] pnetcdf = self.spec['parallel-netcdf']