summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@users.noreply.github.com>2021-11-01 12:55:15 +0000
committerGitHub <noreply@github.com>2021-11-01 07:55:15 -0500
commit80ba7040f8bce05af3f9cb561f8192c120f3e874 (patch)
treeb642d6db617b61b0d4ae5800bf02b6d69c9712f7
parent9094d6bb68a9c1c59bdbd3af496b808448c6de0f (diff)
downloadspack-80ba7040f8bce05af3f9cb561f8192c120f3e874.tar.gz
spack-80ba7040f8bce05af3f9cb561f8192c120f3e874.tar.bz2
spack-80ba7040f8bce05af3f9cb561f8192c120f3e874.tar.xz
spack-80ba7040f8bce05af3f9cb561f8192c120f3e874.zip
python: detect Python from custom Xcode installations (#27023)
-rw-r--r--var/spack/repos/builtin/packages/python/package.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index e62b49dce1..01d0d9a065 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -797,6 +797,14 @@ for plat_specific in [True, False]:
# install libraries into a Frameworks directory
frameworkprefix = self.config_vars['PYTHONFRAMEWORKPREFIX']
+ # Get the active Xcode environment's Framework location.
+ macos_developerdir = os.environ.get('DEVELOPER_DIR')
+ if macos_developerdir and os.path.exists(macos_developerdir):
+ macos_developerdir = os.path.join(
+ macos_developerdir, 'Library', 'Frameworks')
+ else:
+ macos_developerdir = ''
+
if '+shared' in self.spec:
ldlibrary = self.config_vars['LDLIBRARY']
@@ -806,6 +814,9 @@ for plat_specific in [True, False]:
return LibraryList(os.path.join(libpl, ldlibrary))
elif os.path.exists(os.path.join(frameworkprefix, ldlibrary)):
return LibraryList(os.path.join(frameworkprefix, ldlibrary))
+ elif macos_developerdir and \
+ os.path.exists(os.path.join(macos_developerdir, ldlibrary)):
+ return LibraryList(os.path.join(macos_developerdir, ldlibrary))
else:
msg = 'Unable to locate {0} libraries in {1}'
raise RuntimeError(msg.format(ldlibrary, libdir))