We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
New sanity check commands for netCDF break build of older netCDF
This one took me a while to chase down. It might be a wontfix due to old software, but maybe this issue can at least serve as an FFR.

N.b. the easybuild and netCDF tag numbers are very similar here.

[In easybuild v4.6.2 some `nc-config` and `ncgen` sanity check commands were added to the netCDF easyblock](https://github.com/easybuilders/easybuild-easyblocks/commit/d8aa9420be572ab4df2c5993c5a3cdf370623404).

The command `ncgen -h`, in particular, should show the help text for `ncgen`. However, up until netCDF v4.6.1, `ncgen -h` meant running `ncgen` in 'header-only" mode, while `-H` was used for help. These flags were switched in [this commit](https://github.com/Unidata/netcdf-c/commit/2ea1cf5f1bc2a7352e3f66721f5181e26e556011#diff-6f23c24b125838dbee16fd3fd9edf84acc7a0492bd223c5ed03e9095cd50b15e) which first appeared in netCDF v4.6.2.

The problem is that when `ncgen` is run without any other args, or similarly, in "header-only" mode, it waits for stdin until an EOF. This causes the `ncgen` sanity check in the new easyblock to fail.

I think the fix would be to check `ncgen -H` instead of `ncgen -h` for netCDF older than v4.6.2.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `easybuild/easyblocks/n/netcdf.py`
Content:
```
1 ##
2 # Copyright 2009-2023 Ghent University
3 #
4 # This file is part of EasyBuild,
5 # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6 # with support of Ghent University (http://ugent.be/hpc),
7 # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8 # Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9 # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10 #
11 # https://github.com/easybuilders/easybuild
12 #
13 # EasyBuild is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation v2.
16 #
17 # EasyBuild is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.
24 ##
25 """
26 EasyBuild support for building and installing netCDF, implemented as an easyblock
27 
28 @author: Stijn De Weirdt (Ghent University)
29 @author: Dries Verdegem (Ghent University)
30 @author: Kenneth Hoste (Ghent University)
31 @author: Pieter De Baets (Ghent University)
32 @author: Jens Timmerman (Ghent University)
33 """
34 
35 import os
36 from distutils.version import LooseVersion
37 
38 import easybuild.tools.environment as env
39 import easybuild.tools.toolchain as toolchain
40 from easybuild.easyblocks.generic.cmakemake import CMakeMake
41 from easybuild.easyblocks.generic.configuremake import ConfigureMake
42 from easybuild.tools.build_log import EasyBuildError
43 from easybuild.tools.modules import get_software_root, get_software_version, get_software_libdir
44 from easybuild.tools.systemtools import get_shared_lib_ext
45 
46 
47 class EB_netCDF(CMakeMake):
48     """Support for building/installing netCDF"""
49 
50     @staticmethod
51     def extra_options():
52         extra_vars = CMakeMake.extra_options()
53         extra_vars['separate_build_dir'][0] = True
54         return extra_vars
55 
56     def configure_step(self):
57         """Configure build: set config options and configure"""
58 
59         shlib_ext = get_shared_lib_ext()
60 
61         if LooseVersion(self.version) < LooseVersion("4.3"):
62             self.cfg.update('configopts', "--enable-shared")
63 
64             if self.toolchain.options['pic']:
65                 self.cfg.update('configopts', '--with-pic')
66 
67             tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'))
68             self.cfg.update('configopts', 'FCFLAGS="%s" CC="%s" FC="%s"' % tup)
69 
70             # add -DgFortran to CPPFLAGS when building with GCC
71             if self.toolchain.comp_family() == toolchain.GCC:  # @UndefinedVariable
72                 self.cfg.update('configopts', 'CPPFLAGS="%s -DgFortran"' % os.getenv('CPPFLAGS'))
73 
74             ConfigureMake.configure_step(self)
75 
76         else:
77             for (dep, libname) in [('cURL', 'curl'), ('HDF5', 'hdf5'), ('Szip', 'sz'), ('zlib', 'z'),
78                                    ('PnetCDF', 'pnetcdf')]:
79                 dep_root = get_software_root(dep)
80                 dep_libdir = get_software_libdir(dep)
81 
82                 if dep_root:
83                     incdir = os.path.join(dep_root, 'include')
84                     self.cfg.update('configopts', '-D%s_INCLUDE_DIR=%s ' % (dep.upper(), incdir))
85 
86                     if dep == 'HDF5':
87                         env.setvar('HDF5_ROOT', dep_root)
88                         self.cfg.update('configopts', '-DUSE_HDF5=ON')
89 
90                         hdf5cmvars = {
91                             # library name: (cmake option suffix in netcdf<4.4, cmake option suffix in netcfd>=4.4)
92                             'hdf5': ('LIB', 'C_LIBRARY'),
93                             'hdf5_hl': ('HL_LIB', 'HL_LIBRARY'),
94                         }
95 
96                         for libname in hdf5cmvars:
97                             if LooseVersion(self.version) < LooseVersion("4.4"):
98                                 cmvar = hdf5cmvars[libname][0]
99                             else:
100                                 cmvar = hdf5cmvars[libname][1]
101                             libhdf5 = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))
102                             self.cfg.update('configopts', '-DHDF5_%s=%s ' % (cmvar, libhdf5))
103                             # 4.4 forgot to set HDF5_<lang>_LIBRARIES
104                             if LooseVersion(self.version) == LooseVersion("4.4.0"):
105                                 lang = 'HL' if cmvar[0] == 'H' else 'C'
106                                 self.cfg.update('configopts', '-DHDF5_%s_LIBRARIES=%s ' % (lang, libhdf5))
107 
108                     elif dep == 'PnetCDF':
109                         self.cfg.update('configopts', '-DENABLE_PNETCDF=ON')
110 
111                     else:
112                         libso = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))
113                         self.cfg.update('configopts', '-D%s_LIBRARY=%s ' % (dep.upper(), libso))
114 
115             CMakeMake.configure_step(self)
116 
117     def sanity_check_step(self):
118         """
119         Custom sanity check for netCDF
120         """
121 
122         shlib_ext = get_shared_lib_ext()
123 
124         incs = ["netcdf.h"]
125         libs = ["libnetcdf.%s" % shlib_ext, "libnetcdf.a"]
126         # since v4.2, the non-C libraries have been split off in seperate extensions_step
127         # see netCDF-Fortran and netCDF-C++
128         if LooseVersion(self.version) < LooseVersion("4.2"):
129             incs += ["netcdf%s" % x for x in ["cpp.h", ".hh", ".inc", ".mod"]]
130             incs += ["ncvalues.h", "typesizes.mod"]
131             libs += ["libnetcdf_c++.%s" % shlib_ext, "libnetcdff.%s" % shlib_ext,
132                      "libnetcdf_c++.a", "libnetcdff.a"]
133         binaries = ["nc%s" % x for x in ["-config", "copy", "dump", "gen", "gen3"]]
134 
135         custom_paths = {
136             'files': (
137                 [os.path.join("bin", x) for x in binaries] +
138                 [os.path.join("lib", x) for x in libs] +
139                 [os.path.join("include", x) for x in incs]
140             ),
141             'dirs': []
142         }
143 
144         custom_commands = [
145             "nc-config --help",
146             "ncgen -h",
147         ]
148 
149         super(EB_netCDF, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)
150 
151 
152 def set_netcdf_env_vars(log):
153     """Set netCDF environment variables used by other software."""
154 
155     netcdf = get_software_root('netCDF')
156     if not netcdf:
157         raise EasyBuildError("netCDF module not loaded?")
158     else:
159         env.setvar('NETCDF', netcdf)
160         log.debug("Set NETCDF to %s" % netcdf)
161         netcdff = get_software_root('netCDF-Fortran')
162         netcdf_ver = get_software_version('netCDF')
163         if not netcdff:
164             if LooseVersion(netcdf_ver) >= LooseVersion("4.2"):
165                 raise EasyBuildError("netCDF v4.2 no longer supplies Fortran library, also need netCDF-Fortran")
166         else:
167             env.setvar('NETCDFF', netcdff)
168             log.debug("Set NETCDFF to %s" % netcdff)
169
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/easybuild/easyblocks/n/netcdf.py b/easybuild/easyblocks/n/netcdf.py
--- a/easybuild/easyblocks/n/netcdf.py
+++ b/easybuild/easyblocks/n/netcdf.py
@@ -143,7 +143,7 @@
 
         custom_commands = [
             "nc-config --help",
-            "ncgen -h",
+            "ncgen -h" if LooseVersion(self.version) > LooseVersion("4.6.1") else "ncgen -H",
         ]
 
         super(EB_netCDF, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)

{"golden_diff": "diff --git a/easybuild/easyblocks/n/netcdf.py b/easybuild/easyblocks/n/netcdf.py\n--- a/easybuild/easyblocks/n/netcdf.py\n+++ b/easybuild/easyblocks/n/netcdf.py\n@@ -143,7 +143,7 @@\n \n         custom_commands = [\n             \"nc-config --help\",\n-            \"ncgen -h\",\n+            \"ncgen -h\" if LooseVersion(self.version) > LooseVersion(\"4.6.1\") else \"ncgen -H\",\n         ]\n \n         super(EB_netCDF, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)\n", "issue": "New sanity check commands for netCDF break build of older netCDF\nThis one took me a while to chase down. It might be a wontfix due to old software, but maybe this issue can at least serve as an FFR.\r\n\r\nN.b. the easybuild and netCDF tag numbers are very similar here.\r\n\r\n[In easybuild v4.6.2 some `nc-config` and `ncgen` sanity check commands were added to the netCDF easyblock](https://github.com/easybuilders/easybuild-easyblocks/commit/d8aa9420be572ab4df2c5993c5a3cdf370623404).\r\n\r\nThe command `ncgen -h`, in particular, should show the help text for `ncgen`. However, up until netCDF v4.6.1, `ncgen -h` meant running `ncgen` in 'header-only\" mode, while `-H` was used for help. These flags were switched in [this commit](https://github.com/Unidata/netcdf-c/commit/2ea1cf5f1bc2a7352e3f66721f5181e26e556011#diff-6f23c24b125838dbee16fd3fd9edf84acc7a0492bd223c5ed03e9095cd50b15e) which first appeared in netCDF v4.6.2.\r\n\r\nThe problem is that when `ncgen` is run without any other args, or similarly, in \"header-only\" mode, it waits for stdin until an EOF. This causes the `ncgen` sanity check in the new easyblock to fail.\r\n\r\nI think the fix would be to check `ncgen -H` instead of `ncgen -h` for netCDF older than v4.6.2.\n", "before_files": [{"content": "##\n# Copyright 2009-2023 Ghent University\n#\n# This file is part of EasyBuild,\n# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),\n# with support of Ghent University (http://ugent.be/hpc),\n# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),\n# Flemish Research Foundation (FWO) (http://www.fwo.be/en)\n# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).\n#\n# https://github.com/easybuilders/easybuild\n#\n# EasyBuild is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation v2.\n#\n# EasyBuild is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.\n##\n\"\"\"\nEasyBuild support for building and installing netCDF, implemented as an easyblock\n\n@author: Stijn De Weirdt (Ghent University)\n@author: Dries Verdegem (Ghent University)\n@author: Kenneth Hoste (Ghent University)\n@author: Pieter De Baets (Ghent University)\n@author: Jens Timmerman (Ghent University)\n\"\"\"\n\nimport os\nfrom distutils.version import LooseVersion\n\nimport easybuild.tools.environment as env\nimport easybuild.tools.toolchain as toolchain\nfrom easybuild.easyblocks.generic.cmakemake import CMakeMake\nfrom easybuild.easyblocks.generic.configuremake import ConfigureMake\nfrom easybuild.tools.build_log import EasyBuildError\nfrom easybuild.tools.modules import get_software_root, get_software_version, get_software_libdir\nfrom easybuild.tools.systemtools import get_shared_lib_ext\n\n\nclass EB_netCDF(CMakeMake):\n    \"\"\"Support for building/installing netCDF\"\"\"\n\n    @staticmethod\n    def extra_options():\n        extra_vars = CMakeMake.extra_options()\n        extra_vars['separate_build_dir'][0] = True\n        return extra_vars\n\n    def configure_step(self):\n        \"\"\"Configure build: set config options and configure\"\"\"\n\n        shlib_ext = get_shared_lib_ext()\n\n        if LooseVersion(self.version) < LooseVersion(\"4.3\"):\n            self.cfg.update('configopts', \"--enable-shared\")\n\n            if self.toolchain.options['pic']:\n                self.cfg.update('configopts', '--with-pic')\n\n            tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'))\n            self.cfg.update('configopts', 'FCFLAGS=\"%s\" CC=\"%s\" FC=\"%s\"' % tup)\n\n            # add -DgFortran to CPPFLAGS when building with GCC\n            if self.toolchain.comp_family() == toolchain.GCC:  # @UndefinedVariable\n                self.cfg.update('configopts', 'CPPFLAGS=\"%s -DgFortran\"' % os.getenv('CPPFLAGS'))\n\n            ConfigureMake.configure_step(self)\n\n        else:\n            for (dep, libname) in [('cURL', 'curl'), ('HDF5', 'hdf5'), ('Szip', 'sz'), ('zlib', 'z'),\n                                   ('PnetCDF', 'pnetcdf')]:\n                dep_root = get_software_root(dep)\n                dep_libdir = get_software_libdir(dep)\n\n                if dep_root:\n                    incdir = os.path.join(dep_root, 'include')\n                    self.cfg.update('configopts', '-D%s_INCLUDE_DIR=%s ' % (dep.upper(), incdir))\n\n                    if dep == 'HDF5':\n                        env.setvar('HDF5_ROOT', dep_root)\n                        self.cfg.update('configopts', '-DUSE_HDF5=ON')\n\n                        hdf5cmvars = {\n                            # library name: (cmake option suffix in netcdf<4.4, cmake option suffix in netcfd>=4.4)\n                            'hdf5': ('LIB', 'C_LIBRARY'),\n                            'hdf5_hl': ('HL_LIB', 'HL_LIBRARY'),\n                        }\n\n                        for libname in hdf5cmvars:\n                            if LooseVersion(self.version) < LooseVersion(\"4.4\"):\n                                cmvar = hdf5cmvars[libname][0]\n                            else:\n                                cmvar = hdf5cmvars[libname][1]\n                            libhdf5 = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))\n                            self.cfg.update('configopts', '-DHDF5_%s=%s ' % (cmvar, libhdf5))\n                            # 4.4 forgot to set HDF5_<lang>_LIBRARIES\n                            if LooseVersion(self.version) == LooseVersion(\"4.4.0\"):\n                                lang = 'HL' if cmvar[0] == 'H' else 'C'\n                                self.cfg.update('configopts', '-DHDF5_%s_LIBRARIES=%s ' % (lang, libhdf5))\n\n                    elif dep == 'PnetCDF':\n                        self.cfg.update('configopts', '-DENABLE_PNETCDF=ON')\n\n                    else:\n                        libso = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))\n                        self.cfg.update('configopts', '-D%s_LIBRARY=%s ' % (dep.upper(), libso))\n\n            CMakeMake.configure_step(self)\n\n    def sanity_check_step(self):\n        \"\"\"\n        Custom sanity check for netCDF\n        \"\"\"\n\n        shlib_ext = get_shared_lib_ext()\n\n        incs = [\"netcdf.h\"]\n        libs = [\"libnetcdf.%s\" % shlib_ext, \"libnetcdf.a\"]\n        # since v4.2, the non-C libraries have been split off in seperate extensions_step\n        # see netCDF-Fortran and netCDF-C++\n        if LooseVersion(self.version) < LooseVersion(\"4.2\"):\n            incs += [\"netcdf%s\" % x for x in [\"cpp.h\", \".hh\", \".inc\", \".mod\"]]\n            incs += [\"ncvalues.h\", \"typesizes.mod\"]\n            libs += [\"libnetcdf_c++.%s\" % shlib_ext, \"libnetcdff.%s\" % shlib_ext,\n                     \"libnetcdf_c++.a\", \"libnetcdff.a\"]\n        binaries = [\"nc%s\" % x for x in [\"-config\", \"copy\", \"dump\", \"gen\", \"gen3\"]]\n\n        custom_paths = {\n            'files': (\n                [os.path.join(\"bin\", x) for x in binaries] +\n                [os.path.join(\"lib\", x) for x in libs] +\n                [os.path.join(\"include\", x) for x in incs]\n            ),\n            'dirs': []\n        }\n\n        custom_commands = [\n            \"nc-config --help\",\n            \"ncgen -h\",\n        ]\n\n        super(EB_netCDF, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)\n\n\ndef set_netcdf_env_vars(log):\n    \"\"\"Set netCDF environment variables used by other software.\"\"\"\n\n    netcdf = get_software_root('netCDF')\n    if not netcdf:\n        raise EasyBuildError(\"netCDF module not loaded?\")\n    else:\n        env.setvar('NETCDF', netcdf)\n        log.debug(\"Set NETCDF to %s\" % netcdf)\n        netcdff = get_software_root('netCDF-Fortran')\n        netcdf_ver = get_software_version('netCDF')\n        if not netcdff:\n            if LooseVersion(netcdf_ver) >= LooseVersion(\"4.2\"):\n                raise EasyBuildError(\"netCDF v4.2 no longer supplies Fortran library, also need netCDF-Fortran\")\n        else:\n            env.setvar('NETCDFF', netcdff)\n            log.debug(\"Set NETCDFF to %s\" % netcdff)\n", "path": "easybuild/easyblocks/n/netcdf.py"}], "after_files": [{"content": "##\n# Copyright 2009-2023 Ghent University\n#\n# This file is part of EasyBuild,\n# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),\n# with support of Ghent University (http://ugent.be/hpc),\n# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),\n# Flemish Research Foundation (FWO) (http://www.fwo.be/en)\n# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).\n#\n# https://github.com/easybuilders/easybuild\n#\n# EasyBuild is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation v2.\n#\n# EasyBuild is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.\n##\n\"\"\"\nEasyBuild support for building and installing netCDF, implemented as an easyblock\n\n@author: Stijn De Weirdt (Ghent University)\n@author: Dries Verdegem (Ghent University)\n@author: Kenneth Hoste (Ghent University)\n@author: Pieter De Baets (Ghent University)\n@author: Jens Timmerman (Ghent University)\n\"\"\"\n\nimport os\nfrom distutils.version import LooseVersion\n\nimport easybuild.tools.environment as env\nimport easybuild.tools.toolchain as toolchain\nfrom easybuild.easyblocks.generic.cmakemake import CMakeMake\nfrom easybuild.easyblocks.generic.configuremake import ConfigureMake\nfrom easybuild.tools.build_log import EasyBuildError\nfrom easybuild.tools.modules import get_software_root, get_software_version, get_software_libdir\nfrom easybuild.tools.systemtools import get_shared_lib_ext\n\n\nclass EB_netCDF(CMakeMake):\n    \"\"\"Support for building/installing netCDF\"\"\"\n\n    @staticmethod\n    def extra_options():\n        extra_vars = CMakeMake.extra_options()\n        extra_vars['separate_build_dir'][0] = True\n        return extra_vars\n\n    def configure_step(self):\n        \"\"\"Configure build: set config options and configure\"\"\"\n\n        shlib_ext = get_shared_lib_ext()\n\n        if LooseVersion(self.version) < LooseVersion(\"4.3\"):\n            self.cfg.update('configopts', \"--enable-shared\")\n\n            if self.toolchain.options['pic']:\n                self.cfg.update('configopts', '--with-pic')\n\n            tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'))\n            self.cfg.update('configopts', 'FCFLAGS=\"%s\" CC=\"%s\" FC=\"%s\"' % tup)\n\n            # add -DgFortran to CPPFLAGS when building with GCC\n            if self.toolchain.comp_family() == toolchain.GCC:  # @UndefinedVariable\n                self.cfg.update('configopts', 'CPPFLAGS=\"%s -DgFortran\"' % os.getenv('CPPFLAGS'))\n\n            ConfigureMake.configure_step(self)\n\n        else:\n            for (dep, libname) in [('cURL', 'curl'), ('HDF5', 'hdf5'), ('Szip', 'sz'), ('zlib', 'z'),\n                                   ('PnetCDF', 'pnetcdf')]:\n                dep_root = get_software_root(dep)\n                dep_libdir = get_software_libdir(dep)\n\n                if dep_root:\n                    incdir = os.path.join(dep_root, 'include')\n                    self.cfg.update('configopts', '-D%s_INCLUDE_DIR=%s ' % (dep.upper(), incdir))\n\n                    if dep == 'HDF5':\n                        env.setvar('HDF5_ROOT', dep_root)\n                        self.cfg.update('configopts', '-DUSE_HDF5=ON')\n\n                        hdf5cmvars = {\n                            # library name: (cmake option suffix in netcdf<4.4, cmake option suffix in netcfd>=4.4)\n                            'hdf5': ('LIB', 'C_LIBRARY'),\n                            'hdf5_hl': ('HL_LIB', 'HL_LIBRARY'),\n                        }\n\n                        for libname in hdf5cmvars:\n                            if LooseVersion(self.version) < LooseVersion(\"4.4\"):\n                                cmvar = hdf5cmvars[libname][0]\n                            else:\n                                cmvar = hdf5cmvars[libname][1]\n                            libhdf5 = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))\n                            self.cfg.update('configopts', '-DHDF5_%s=%s ' % (cmvar, libhdf5))\n                            # 4.4 forgot to set HDF5_<lang>_LIBRARIES\n                            if LooseVersion(self.version) == LooseVersion(\"4.4.0\"):\n                                lang = 'HL' if cmvar[0] == 'H' else 'C'\n                                self.cfg.update('configopts', '-DHDF5_%s_LIBRARIES=%s ' % (lang, libhdf5))\n\n                    elif dep == 'PnetCDF':\n                        self.cfg.update('configopts', '-DENABLE_PNETCDF=ON')\n\n                    else:\n                        libso = os.path.join(dep_root, dep_libdir, 'lib%s.%s' % (libname, shlib_ext))\n                        self.cfg.update('configopts', '-D%s_LIBRARY=%s ' % (dep.upper(), libso))\n\n            CMakeMake.configure_step(self)\n\n    def sanity_check_step(self):\n        \"\"\"\n        Custom sanity check for netCDF\n        \"\"\"\n\n        shlib_ext = get_shared_lib_ext()\n\n        incs = [\"netcdf.h\"]\n        libs = [\"libnetcdf.%s\" % shlib_ext, \"libnetcdf.a\"]\n        # since v4.2, the non-C libraries have been split off in seperate extensions_step\n        # see netCDF-Fortran and netCDF-C++\n        if LooseVersion(self.version) < LooseVersion(\"4.2\"):\n            incs += [\"netcdf%s\" % x for x in [\"cpp.h\", \".hh\", \".inc\", \".mod\"]]\n            incs += [\"ncvalues.h\", \"typesizes.mod\"]\n            libs += [\"libnetcdf_c++.%s\" % shlib_ext, \"libnetcdff.%s\" % shlib_ext,\n                     \"libnetcdf_c++.a\", \"libnetcdff.a\"]\n        binaries = [\"nc%s\" % x for x in [\"-config\", \"copy\", \"dump\", \"gen\", \"gen3\"]]\n\n        custom_paths = {\n            'files': (\n                [os.path.join(\"bin\", x) for x in binaries] +\n                [os.path.join(\"lib\", x) for x in libs] +\n                [os.path.join(\"include\", x) for x in incs]\n            ),\n            'dirs': []\n        }\n\n        custom_commands = [\n            \"nc-config --help\",\n            \"ncgen -h\" if LooseVersion(self.version) > LooseVersion(\"4.6.1\") else \"ncgen -H\",\n        ]\n\n        super(EB_netCDF, self).sanity_check_step(custom_commands=custom_commands, custom_paths=custom_paths)\n\n\ndef set_netcdf_env_vars(log):\n    \"\"\"Set netCDF environment variables used by other software.\"\"\"\n\n    netcdf = get_software_root('netCDF')\n    if not netcdf:\n        raise EasyBuildError(\"netCDF module not loaded?\")\n    else:\n        env.setvar('NETCDF', netcdf)\n        log.debug(\"Set NETCDF to %s\" % netcdf)\n        netcdff = get_software_root('netCDF-Fortran')\n        netcdf_ver = get_software_version('netCDF')\n        if not netcdff:\n            if LooseVersion(netcdf_ver) >= LooseVersion(\"4.2\"):\n                raise EasyBuildError(\"netCDF v4.2 no longer supplies Fortran library, also need netCDF-Fortran\")\n        else:\n            env.setvar('NETCDFF', netcdff)\n            log.debug(\"Set NETCDFF to %s\" % netcdff)\n", "path": "easybuild/easyblocks/n/netcdf.py"}]}