Remove distutils dependency in Spack (#40153)

* msvc.py: don't import distutils

Introduced in #27021, makes Spack forward incompatible with Python.

The module was already deprecated at the time of the PR.

* update spack package
This commit is contained in:
Harmen Stoppels 2023-09-22 13:04:58 +02:00 committed by GitHub
parent f42402129a
commit 716196930a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -7,7 +7,6 @@
import re import re
import subprocess import subprocess
import sys import sys
from distutils.version import StrictVersion
from typing import Dict, List, Set from typing import Dict, List, Set
import spack.compiler import spack.compiler
@ -115,11 +114,11 @@ def command_str(self):
def get_valid_fortran_pth(comp_ver): def get_valid_fortran_pth(comp_ver):
cl_ver = str(comp_ver) cl_ver = str(comp_ver)
sort_fn = lambda fc_ver: StrictVersion(fc_ver) sort_fn = lambda fc_ver: Version(fc_ver)
sort_fc_ver = sorted(list(avail_fc_version), key=sort_fn) sort_fc_ver = sorted(list(avail_fc_version), key=sort_fn)
for ver in sort_fc_ver: for ver in sort_fc_ver:
if ver in fortran_mapping: if ver in fortran_mapping:
if StrictVersion(cl_ver) <= StrictVersion(fortran_mapping[ver]): if Version(cl_ver) <= Version(fortran_mapping[ver]):
return fc_path[ver] return fc_path[ver]
return None return None

View File

@ -61,10 +61,15 @@ class Spack(Package):
# This should be read as "require at least curl", not "require curl". # This should be read as "require at least curl", not "require curl".
requires("fetchers=curl", when="@:0.16", msg="Curl is required for Spack < 0.17") requires("fetchers=curl", when="@:0.16", msg="Curl is required for Spack < 0.17")
# Python (with spack python -i ipython support) # Python
depends_on("python@2.6.0:2.7,3.5:", type="run") depends_on("python@2.6.0:2.7,3.5:", type="run")
depends_on("python@2.7.0:2.7,3.5:", type="run", when="@0.18.0:") depends_on("python@2.7.0:2.7,3.5:", type="run", when="@0.18.0:")
depends_on("python@2.7.0:2.7,3.6:", type="run", when="@0.19.0:") depends_on("python@2.7.0:2.7,3.6:", type="run", when="@0.19.0:")
# Old Spack unfortunately depends on distutils, removed in Python 3.12
depends_on("python@:3.12", type="run", when="@0.18:0.20.1")
# spack python -i ipython support
depends_on("py-ipython", type="run") depends_on("py-ipython", type="run")
# Concretizer # Concretizer