fix spack external find for Python >= 3.13 (#48170)

Python >= 3.13 does not have the crypt variant anymore. Still no matter
if the test for crypt succeeds (which it can on Fedora providing its own
crypt module for Python 3.13) or fails, it will add +crypt or ~crypt,
which both fail because the variant only exists until Python 3.12.

Co-authored-by: Richard Berger <rberger@lanl.gov>
This commit is contained in:
Philipp Edelmann 2024-12-23 11:56:13 -07:00 committed by GitHub
parent da97e9eaa7
commit 250de0cdf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -364,7 +364,7 @@ def determine_variants(cls, exes, version_str):
variants += "~tix"
# Some modules are platform-dependent
if sys.platform != "win32":
if sys.platform != "win32" and Version(version_str) < Version("3.13"):
try:
python("-c", "import crypt", error=os.devnull)
variants += "+crypt"