From 474493713b15a9cd76fafa778a857f3ea22b0060 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 14 Mar 2022 12:27:49 +0100 Subject: [PATCH] compiler.py: early return in compiler_environment when no modules (#29441) --- lib/spack/spack/compiler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index b8ebc622f22..976699702b4 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -598,6 +598,11 @@ def __str__(self): @contextlib.contextmanager def compiler_environment(self): + # yield immediately if no modules + if not self.modules: + yield + return + # store environment to replace later backup_env = os.environ.copy()