summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-05-10 11:45:44 -0700
committerscheibelp <scheibel1@llnl.gov>2018-05-17 14:10:30 -0700
commit6f2cac9565cd50cded141533b1594faa02c4b2f6 (patch)
treea289b033187bd5d116199657eafcb46517a67950 /var
parentc615d2be06eeaf10058ddece27f69d6e148f44af (diff)
downloadspack-6f2cac9565cd50cded141533b1594faa02c4b2f6.tar.gz
spack-6f2cac9565cd50cded141533b1594faa02c4b2f6.tar.bz2
spack-6f2cac9565cd50cded141533b1594faa02c4b2f6.tar.xz
spack-6f2cac9565cd50cded141533b1594faa02c4b2f6.zip
init: initialize spack.store lazily
- spack.store was previously initialized at the spack.store module level, but this means the store has to be initialized on every spack call. - this moves the state in spack.store to a singleton so that the store is only initialized when needed.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/aspell/package.py12
-rw-r--r--var/spack/repos/builtin/packages/cbtf-krell/package.py19
-rw-r--r--var/spack/repos/builtin/packages/openspeedshop/package.py3
-rw-r--r--var/spack/repos/builtin/packages/perl/package.py4
-rw-r--r--var/spack/repos/builtin/packages/python/package.py8
5 files changed, 24 insertions, 22 deletions
diff --git a/var/spack/repos/builtin/packages/aspell/package.py b/var/spack/repos/builtin/packages/aspell/package.py
index 66eeb9e7cb..1b23258099 100644
--- a/var/spack/repos/builtin/packages/aspell/package.py
+++ b/var/spack/repos/builtin/packages/aspell/package.py
@@ -50,8 +50,8 @@ class Aspell(AutotoolsPackage):
# - dest_dir instead of self.prefix in tree.(find_conflict|merge)()
def activate(self, extension, **kwargs):
extensions_layout = kwargs.get("extensions_layout",
- spack.store.extensions)
- if extensions_layout is not spack.store.extensions:
+ spack.store.store().extensions)
+ if extensions_layout is not spack.store.store().extensions:
raise ExtensionError(
'aspell does not support non-global extensions')
@@ -60,7 +60,7 @@ class Aspell(AutotoolsPackage):
tree = LinkTree(extension.prefix.lib)
def ignore(filename):
- return (filename in spack.store.layout.hidden_file_paths or
+ return (filename in spack.store.store().layout.hidden_file_paths or
kwargs.get('ignore', lambda f: False)(filename))
conflict = tree.find_conflict(dest_dir, ignore=ignore)
@@ -71,8 +71,8 @@ class Aspell(AutotoolsPackage):
def deactivate(self, extension, **kwargs):
extensions_layout = kwargs.get("extensions_layout",
- spack.store.extensions)
- if extensions_layout is not spack.store.extensions:
+ spack.store.store().extensions)
+ if extensions_layout is not spack.store.store().extensions:
raise ExtensionError(
'aspell does not support non-global extensions')
@@ -80,7 +80,7 @@ class Aspell(AutotoolsPackage):
dest_dir = aspell('dump', 'config', 'dict-dir', output=str).strip()
def ignore(filename):
- return (filename in spack.store.layout.hidden_file_paths or
+ return (filename in spack.store.store().layout.hidden_file_paths or
kwargs.get('ignore', lambda f: False)(filename))
tree = LinkTree(extension.prefix.lib)
diff --git a/var/spack/repos/builtin/packages/cbtf-krell/package.py b/var/spack/repos/builtin/packages/cbtf-krell/package.py
index 15ea33dd79..9ec7853abf 100644
--- a/var/spack/repos/builtin/packages/cbtf-krell/package.py
+++ b/var/spack/repos/builtin/packages/cbtf-krell/package.py
@@ -193,15 +193,16 @@ class CbtfKrell(CMakePackage):
# the login node components with this spack invocation. We
# need these paths to be the ones created in the CNL
# spack invocation.
- be_cbtf = spack.store.db.query_one('cbtf arch=cray-CNL-haswell')
- be_cbtfk = spack.store.db.query_one('cbtf-krell arch=cray-CNL-haswell')
- be_papi = spack.store.db.query_one('papi arch=cray-CNL-haswell')
- be_boost = spack.store.db.query_one('boost arch=cray-CNL-haswell')
- be_mont = spack.store.db.query_one('libmonitor arch=cray-CNL-haswell')
- be_unw = spack.store.db.query_one('libunwind arch=cray-CNL-haswell')
- be_xer = spack.store.db.query_one('xerces-c arch=cray-CNL-haswell')
- be_dyn = spack.store.db.query_one('dyninst arch=cray-CNL-haswell')
- be_mrnet = spack.store.db.query_one('mrnet arch=cray-CNL-haswell')
+ store = spack.store.store()
+ be_cbtf = store.db.query_one('cbtf arch=cray-CNL-haswell')
+ be_cbtfk = store.db.query_one('cbtf-krell arch=cray-CNL-haswell')
+ be_papi = store.db.query_one('papi arch=cray-CNL-haswell')
+ be_boost = store.db.query_one('boost arch=cray-CNL-haswell')
+ be_mont = store.db.query_one('libmonitor arch=cray-CNL-haswell')
+ be_unw = store.db.query_one('libunwind arch=cray-CNL-haswell')
+ be_xer = store.db.query_one('xerces-c arch=cray-CNL-haswell')
+ be_dyn = store.db.query_one('dyninst arch=cray-CNL-haswell')
+ be_mrnet = store.db.query_one('mrnet arch=cray-CNL-haswell')
CrayLoginNodeOptions.append('-DCN_RUNTIME_PLATFORM=%s'
% rt_platform)
diff --git a/var/spack/repos/builtin/packages/openspeedshop/package.py b/var/spack/repos/builtin/packages/openspeedshop/package.py
index 237784e42d..2663a3ff33 100644
--- a/var/spack/repos/builtin/packages/openspeedshop/package.py
+++ b/var/spack/repos/builtin/packages/openspeedshop/package.py
@@ -197,7 +197,8 @@ class Openspeedshop(CMakePackage):
# spec['cbtf'].prefix is the login node value for this build, as
# we only get here when building the login node components and
# that is all that is known to spack.
- be_ck = spack.store.db.query_one('cbtf-krell arch=cray-CNL-haswell')
+ store = spack.store.store()
+ be_ck = store.db.query_one('cbtf-krell arch=cray-CNL-haswell')
# Equivalent to install-tool cmake arg:
# '-DCBTF_KRELL_CN_RUNTIME_DIR=%s'
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
index 1759c15d86..192e31f32f 100644
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -264,7 +264,7 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
super(Perl, self).activate(ext_pkg, **args)
extensions_layout = args.get("extensions_layout",
- spack.store.extensions)
+ spack.store.store().extensions)
exts = extensions_layout.extension_map(self.spec)
exts[ext_pkg.name] = ext_pkg.spec
@@ -276,7 +276,7 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
super(Perl, self).deactivate(ext_pkg, **args)
extensions_layout = args.get("extensions_layout",
- spack.store.extensions)
+ spack.store.store().extensions)
exts = extensions_layout.extension_map(self.spec)
# Make deactivate idempotent
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 34e1e0ea6d..b2ca9a29b4 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -320,7 +320,7 @@ class Python(AutotoolsPackage):
output_filename = None
try:
output_filename = join_path(
- spack.store.layout.metadata_path(self.spec),
+ spack.store.store().layout.metadata_path(self.spec),
Python._DISTUTIL_CACHE_FILENAME)
with open(output_filename, 'w') as output_file:
sjson.dump(self._distutil_vars, output_file)
@@ -342,7 +342,7 @@ class Python(AutotoolsPackage):
if not self._distutil_vars and self.installed:
try:
input_filename = join_path(
- spack.store.layout.metadata_path(self.spec),
+ spack.store.store().layout.metadata_path(self.spec),
Python._DISTUTIL_CACHE_FILENAME)
if os.path.isfile(input_filename):
with open(input_filename) as input_file:
@@ -680,7 +680,7 @@ class Python(AutotoolsPackage):
args.update(ignore=ignore)
extensions_layout = args.get("extensions_layout",
- spack.store.extensions)
+ spack.store.store().extensions)
super(Python, self).activate(ext_pkg, **args)
@@ -696,7 +696,7 @@ class Python(AutotoolsPackage):
super(Python, self).deactivate(ext_pkg, **args)
extensions_layout = args.get("extensions_layout",
- spack.store.extensions)
+ spack.store.store().extensions)
exts = extensions_layout.extension_map(self.spec)
# Make deactivate idempotent