summaryrefslogtreecommitdiff
path: root/lib/spack/spack/build_environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/build_environment.py')
-rw-r--r--lib/spack/spack/build_environment.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 84fc58587e..13ee99d177 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -422,6 +422,11 @@ def set_build_environment_variables(pkg, env, dirty):
def _set_variables_for_single_module(pkg, module):
"""Helper function to set module variables for single module."""
+ # Put a marker on this module so that it won't execute the body of this
+ # function again, since it is not needed
+ marker = '_set_run_already_called'
+ if getattr(module, marker, False):
+ return
jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1
jobs = min(jobs, multiprocessing.cpu_count())
@@ -489,6 +494,10 @@ def _set_variables_for_single_module(pkg, module):
m.static_to_shared_library = static_to_shared_library
+ # Put a marker on this module so that it won't execute the body of this
+ # function again, since it is not needed
+ setattr(m, marker, True)
+
def set_module_variables_for_package(pkg):
"""Populate the module scope of install() with some useful functions.