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).
This commit is contained in:
Adam J. Stewart 2023-10-20 01:29:38 -05:00 committed by GitHub
parent c9e5173bbd
commit 0907d43783
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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):