diff --git a/easybuild/toolchains/nvhpc.py b/easybuild/toolchains/nvhpc.py index 251f669573..eef80b81bf 100644 --- a/easybuild/toolchains/nvhpc.py +++ b/easybuild/toolchains/nvhpc.py @@ -31,11 +31,14 @@ * Andreas Herten (Forschungszentrum Juelich) * Alex Domingo (Vrije Universiteit Brussel) """ +import inspect + from easybuild.toolchains.gcccore import GCCcore from easybuild.toolchains.linalg.nvblas import NVBLAS from easybuild.toolchains.linalg.nvscalapack import NVScaLAPACK from easybuild.toolchains.mpi.nvhpcx import NVHPCX from easybuild.toolchains.nvidia_compilers import NvidiaCompilersToolchain +from easybuild.tools.build_log import print_warning from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME @@ -51,8 +54,8 @@ def __new__(cls, *args, **kwargs): # legacy NVHPC toolchains are compiler-only toolchains # on top of GCCcore, switch to corresponding class return NVHPCToolchain(*args, **kwargs) - else: - return super().__new__(cls) + + return super().__new__(cls) class NVHPCToolchain(NvidiaCompilersToolchain): @@ -65,4 +68,10 @@ class NVHPCToolchain(NvidiaCompilersToolchain): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.log.deprecated("NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0", '6.0') + # print deprecation warning (stick to warning level in CI tests) + warn_msg = "NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0" + in_test_env = any('unittest' in frame.filename for frame in inspect.stack()) + if in_test_env: + print_warning(warn_msg) + else: + self.log.deprecated(warn_msg, '6.0')