Remove the spack.architecture module (#25986)

The `spack.architecture` module contains an `Arch` class that is very similar to `spack.spec.ArchSpec` but points to platform, operating system and target objects rather than "names". There's a TODO in the class since 2016:

abb0f6e27c/lib/spack/spack/architecture.py (L70-L75)

and this PR basically addresses that. Since there are just a few places where the `Arch` class was used, here we query the relevant platform objects where they are needed directly from `spack.platforms`. This permits to clean the code from vestigial logic.

Modifications:
- [x] Remove the `spack.architecture` module and replace its use by `spack.platforms`
- [x] Remove unneeded tests
This commit is contained in:
Massimiliano Culpo
2021-10-06 19:28:12 +02:00
committed by GitHub
parent 232086c6af
commit 319ae9254e
37 changed files with 282 additions and 441 deletions

View File

@@ -5,7 +5,7 @@
from six import string_types
import spack.architecture
import spack.platforms
from spack import *
from spack.pkg.builtin.mock.multimethod_base import MultimethodBase
@@ -83,7 +83,7 @@ def has_a_default(self):
#
# Make sure we can switch methods on different target
#
platform = spack.architecture.platform()
platform = spack.platforms.host()
targets = list(platform.targets.values())
if len(targets) > 1:
targets = targets[:-1]

View File

@@ -43,7 +43,7 @@
def get_os():
spack_os = spack.architecture.platform().default_os
spack_os = spack.platforms.host().default_os
return _os_map.get(spack_os, 'RHEL-7')

View File

@@ -10,7 +10,7 @@
import llnl.util.tty as tty
import spack.architecture
import spack.platforms
import spack.util.executable
from spack.operating_systems.mac_os import macos_sdk_path, macos_version
@@ -324,7 +324,7 @@ def filter_detected_exes(cls, prefix, exes_in_prefix):
continue
# Filter out links in favor of real executables on
# all systems but Cray
host_platform = str(spack.architecture.platform())
host_platform = str(spack.platforms.host())
if os.path.islink(exe) and host_platform != 'cray':
continue

View File

@@ -2,12 +2,11 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
from tempfile import NamedTemporaryFile
from spack import architecture
import spack.platforms
class Sqlite(AutotoolsPackage):
@@ -168,9 +167,8 @@ def libs(self):
return find_libraries('libsqlite3', root=self.prefix.lib)
def get_arch(self):
arch = architecture.Arch()
arch.platform = architecture.platform()
return str(arch.platform.target('default_target'))
host_platform = spack.platforms.host()
return str(host_platform.target('default_target'))
def configure_args(self):
args = []

View File

@@ -7,7 +7,7 @@
def cross_detect():
if spack.architecture.platform().name == 'cray':
if spack.platforms.host().name == 'cray':
if which('srun'):
return 'cray-aries-slurm'
if which('aprun'):