summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2021-08-26 15:44:31 -0500
committerGitHub <noreply@github.com>2021-08-26 20:44:31 +0000
commit6eb942cf456e8f2db328d5ea0dff52eb4f013aba (patch)
treea2d817a47e2e23d035f45e8ba9ca0a5643d2d23f /lib
parent9dab298f0dd7faba604c0946b2e1e278dc93338d (diff)
downloadspack-6eb942cf456e8f2db328d5ea0dff52eb4f013aba.tar.gz
spack-6eb942cf456e8f2db328d5ea0dff52eb4f013aba.tar.bz2
spack-6eb942cf456e8f2db328d5ea0dff52eb4f013aba.tar.xz
spack-6eb942cf456e8f2db328d5ea0dff52eb4f013aba.zip
Speedup environment activation, part 2 (#25633)
This is a direct followup to #13557 which caches additional attributes that were added in #24095 that are expensive to compute. I had to reopen #25556 in another PR to invalidate the GitLab CI cache, but see #25556 for prior discussion. ### Before ```console $ time spack env activate . real 2m13.037s user 1m25.584s sys 0m43.654s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 16m3.541s user 10m28.892s sys 4m57.816s $ time spack env deactivate real 2m30.974s user 1m38.090s sys 0m49.781s ``` ### After ```console $ time spack env activate . real 0m8.937s user 0m7.323s sys 0m1.074s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 2m22.024s user 1m44.739s sys 0m30.717s $ time spack env deactivate real 0m10.398s user 0m8.414s sys 0m1.630s ``` Fixes #25555 Fixes #25541 * Speedup environment activation, part 2 * Only query distutils a single time * Fix KeyError bug * Make vermin happy * Manual memoize * Add comment on cross-compiling * Use platform-specific include directory * Fix multiple bugs * Fix python_inc discrepancy * Fix import tests
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/python.py16
-rw-r--r--lib/spack/spack/build_systems/sip.py5
2 files changed, 13 insertions, 8 deletions
diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py
index 27b1d4a10c..c3bf323d84 100644
--- a/lib/spack/spack/build_systems/python.py
+++ b/lib/spack/spack/build_systems/python.py
@@ -127,7 +127,10 @@ class PythonPackage(PackageBase):
list: list of strings of module names
"""
modules = []
- root = self.spec['python'].package.get_python_lib(prefix=self.prefix)
+ root = os.path.join(
+ self.prefix,
+ self.spec['python'].package.config_vars['python_lib']['false']['false'],
+ )
# Some Python libraries are packages: collections of modules
# distributed in directories containing __init__.py files
@@ -252,12 +255,11 @@ class PythonPackage(PackageBase):
# Get all relative paths since we set the root to `prefix`
# We query the python with which these will be used for the lib and inc
# directories. This ensures we use `lib`/`lib64` as expected by python.
- pure_site_packages_dir = spec['python'].package.get_python_lib(
- plat_specific=False, prefix='')
- plat_site_packages_dir = spec['python'].package.get_python_lib(
- plat_specific=True, prefix='')
- inc_dir = spec['python'].package.get_python_inc(
- plat_specific=True, prefix='')
+ pure_site_packages_dir = spec['python'].package.config_vars[
+ 'python_lib']['false']['false']
+ plat_site_packages_dir = spec['python'].package.config_vars[
+ 'python_lib']['true']['false']
+ inc_dir = spec['python'].package.config_vars['python_inc']['true']
args += ['--root=%s' % prefix,
'--install-purelib=%s' % pure_site_packages_dir,
diff --git a/lib/spack/spack/build_systems/sip.py b/lib/spack/spack/build_systems/sip.py
index 744989e2d6..1b9d01fbf4 100644
--- a/lib/spack/spack/build_systems/sip.py
+++ b/lib/spack/spack/build_systems/sip.py
@@ -64,7 +64,10 @@ class SIPPackage(PackageBase):
list: list of strings of module names
"""
modules = []
- root = self.spec['python'].package.get_python_lib(prefix=self.prefix)
+ root = os.path.join(
+ self.prefix,
+ self.spec['python'].package.config_vars['python_lib']['false']['false'],
+ )
# Some Python libraries are packages: collections of modules
# distributed in directories containing __init__.py files