Speedup environment activation (#13557)
* Add a transaction around repeated calls to `spec.prefix` in the activation process * cache the computation of home in the python package to speed up setting deps * ensure that module-scope variables are only set *once* per module
This commit is contained in:

committed by
Todd Gamblin

parent
1b624b9d45
commit
bca59f8d83
@@ -163,6 +163,9 @@ class Python(AutotoolsPackage):
|
||||
_DISTUTIL_CACHE_FILENAME = 'sysconfig.json'
|
||||
_distutil_vars = None
|
||||
|
||||
# Used to cache home locations, since computing them might be expensive
|
||||
_homes = {}
|
||||
|
||||
# An in-source build with --enable-optimizations fails for python@3.X
|
||||
build_directory = 'spack-build'
|
||||
|
||||
@@ -622,8 +625,11 @@ def home(self):
|
||||
``packages.yaml`` unknowingly. Query the python executable to
|
||||
determine exactly where it is installed."""
|
||||
|
||||
prefix = self.get_config_var('prefix')
|
||||
return Prefix(prefix)
|
||||
dag_hash = self.spec.dag_hash()
|
||||
if dag_hash not in self._homes:
|
||||
prefix = self.get_config_var('prefix')
|
||||
self._homes[dag_hash] = Prefix(prefix)
|
||||
return self._homes[dag_hash]
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
|
Reference in New Issue
Block a user