summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-04-24 15:39:49 -0700
committerscheibelp <scheibel1@llnl.gov>2018-05-17 14:10:30 -0700
commitd4709673b571f882d6f10e4e317addd46ded65f2 (patch)
treedcf040d9aa029e897558da3ee6e153f90b14110e /lib
parent2ab7b7a5a0533739f7e4a4cef7eb4336c795f514 (diff)
downloadspack-d4709673b571f882d6f10e4e317addd46ded65f2.tar.gz
spack-d4709673b571f882d6f10e4e317addd46ded65f2.tar.bz2
spack-d4709673b571f882d6f10e4e317addd46ded65f2.tar.xz
spack-d4709673b571f882d6f10e4e317addd46ded65f2.zip
init: remove build_jobs global variable
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py13
-rw-r--r--lib/spack/spack/build_environment.py3
-rw-r--r--lib/spack/spack/package.py3
3 files changed, 4 insertions, 15 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index ac35e79d80..b6492dc1a0 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -24,7 +24,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
-import multiprocessing
#-----------------------------------------------------------------------------
# Below code imports spack packages.
@@ -33,22 +32,10 @@ import multiprocessing
# TODO: refactor everything below to be more init order agnostic.
-#-----------------------------------------------------------------------------
-# Import spack.config first, as other modules may rely on its options.
-# TODO: Below code should not import modules other than spack.config
-#-----------------------------------------------------------------------------
-import spack.config
-
-
# TODO: get this out of __init__.py
binary_cache_retrieved_specs = set()
-#: The number of jobs to use when building in parallel.
-#: By default, use all cores on the machine.
-build_jobs = spack.config.get('config:build_jobs', multiprocessing.cpu_count())
-
-
#-----------------------------------------------------------------------------
# Initialize various data structures & objects at the core of Spack.
#
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index fc7b12f8fd..d4f6e36e56 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -65,6 +65,7 @@ import llnl.util.tty as tty
from llnl.util.tty.color import colorize
from llnl.util.filesystem import mkdirp, install, install_tree
+import spack.config
import spack.main
import spack.paths
import spack.store
@@ -347,7 +348,7 @@ def set_module_variables_for_package(pkg, module):
This makes things easier for package writers.
"""
# number of jobs spack will build with.
- jobs = spack.build_jobs
+ jobs = spack.config.get('config:build_jobs') or multiprocessing.cpu_count()
if not pkg.parallel:
jobs = 1
elif pkg.make_jobs:
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 83acb16ce8..a2e588079e 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -54,6 +54,7 @@ from six import with_metaclass
import llnl.util.tty as tty
import spack
+import spack.config
import spack.paths
import spack.store
import spack.compilers
@@ -506,7 +507,7 @@ class PackageBase(with_metaclass(PackageMeta, object)):
parallel = True
#: # jobs to use for parallel make. If set, overrides default of ncpus.
- make_jobs = spack.build_jobs
+ make_jobs = None
#: By default do not run tests within package's install()
run_tests = False