summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-03-14 12:27:49 +0100
committerGitHub <noreply@github.com>2022-03-14 11:27:49 +0000
commit474493713b15a9cd76fafa778a857f3ea22b0060 (patch)
tree0c951c9bfa604e1a9b65f6beef8a157abd463086
parentccfaec7b1c0dbf76d92ee14983a8da3b687260dd (diff)
downloadspack-474493713b15a9cd76fafa778a857f3ea22b0060.tar.gz
spack-474493713b15a9cd76fafa778a857f3ea22b0060.tar.bz2
spack-474493713b15a9cd76fafa778a857f3ea22b0060.tar.xz
spack-474493713b15a9cd76fafa778a857f3ea22b0060.zip
compiler.py: early return in compiler_environment when no modules (#29441)
-rw-r--r--lib/spack/spack/compiler.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py
index b8ebc622f2..976699702b 100644
--- a/lib/spack/spack/compiler.py
+++ b/lib/spack/spack/compiler.py
@@ -598,6 +598,11 @@ class Compiler(object):
@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()