summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernhardkaindl <43588962+bernhardkaindl@users.noreply.github.com>2021-09-09 09:25:55 +0200
committerGitHub <noreply@github.com>2021-09-09 01:25:55 -0600
commited9b38c8e3b22edb2413031bc8af4004b9e1ea3e (patch)
tree1529ae9c49477846144f8cffb6d732fa19a39636
parent1a5891754a2eef39073dba5798af9c525fbbe337 (diff)
downloadspack-ed9b38c8e3b22edb2413031bc8af4004b9e1ea3e.tar.gz
spack-ed9b38c8e3b22edb2413031bc8af4004b9e1ea3e.tar.bz2
spack-ed9b38c8e3b22edb2413031bc8af4004b9e1ea3e.tar.xz
spack-ed9b38c8e3b22edb2413031bc8af4004b9e1ea3e.zip
Fix python/packages.py's config_vars for python2 packages (#25839)
Analysis mostly by me, fix updated after suggestion by Adam J. Steward Co-authored-by: Bernhard Kaindl <bernhard.kaindl@ait.ac.at>
-rw-r--r--var/spack/repos/builtin/packages/python/package.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 470b05f6ac..994578cffb 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -717,10 +717,12 @@ config['python_inc'] = {}
config['python_lib'] = {}
for plat_specific in [True, False]:
- config['python_inc'][plat_specific] = get_python_inc(plat_specific, prefix='')
- config['python_lib'][plat_specific] = {}
+ plat_key = str(plat_specific).lower()
+ config['python_inc'][plat_key] = get_python_inc(plat_specific, prefix='')
+ config['python_lib'][plat_key] = {}
for standard_lib in [True, False]:
- config['python_lib'][plat_specific][standard_lib] = get_python_lib(
+ lib_key = str(standard_lib).lower()
+ config['python_lib'][plat_key][lib_key] = get_python_lib(
plat_specific, standard_lib, prefix=''
)
@@ -841,9 +843,9 @@ for plat_specific in [True, False]:
Returns:
str: include files directory
"""
- if 'python_inc' in self.config_vars:
+ try:
return self.config_vars['python_inc']['false']
- else:
+ except KeyError:
return os.path.join('include', 'python{0}'.format(self.version.up_to(2)))
@property
@@ -865,9 +867,9 @@ for plat_specific in [True, False]:
Returns:
str: standard library directory
"""
- if 'python_lib' in self.config_vars:
+ try:
return self.config_vars['python_lib']['false']['true']
- else:
+ except KeyError:
return os.path.join('lib', 'python{0}'.format(self.version.up_to(2)))
@property
@@ -889,9 +891,9 @@ for plat_specific in [True, False]:
Returns:
str: site-packages directory
"""
- if 'python_lib' in self.config_vars:
+ try:
return self.config_vars['python_lib']['false']['false']
- else:
+ except KeyError:
return self.default_site_packages_dir
@property