From 0907d437838cd3392708d2e0a2053b51e63f45ee Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 20 Oct 2023 01:29:38 -0500 Subject: [PATCH] Drop support for external PythonX.Y (#40628) On some systems, multiple pythonx.y are placed in the same prefix as pythonx (where only one of them is associated with that pythonx). Spack external detection for Python was willing to register all of these as external versions. Moreover, the `package.py` for Python was able to distinguish these. This can cause an issue for some build systems, which will just look for python3 for example, so if that python3 is actually python3.6, and the build system needs 3.7 (which spack may have found in the same prefix, and offered as a suitable external), it will fail when invoking python3. To avoid that issue, we simply avoid treating pythonx.y as external candidates. In the above case, Spack would only detect a Python 3.6 external, and the build would be forced to use a Spack-built Python 3.7 (which we consider a good thing). --- var/spack/repos/builtin/packages/python/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 83dbfb382f..8253ef0f9a 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -326,7 +326,7 @@ class Python(Package): # An in-source build with --enable-optimizations fails for python@3.X build_directory = "spack-build" - executables = [r"^python[\d.]*[mw]?$"] + executables = [r"^python\d?$"] @classmethod def determine_version(cls, exe):