Remove "prevent_cray_detection" context manager (#46060)

This context manager was used to prevent detecting a platform
as "cray". Since now Cray machines are detected as linux, we can
remove the context manager.
This commit is contained in:
Massimiliano Culpo 2024-08-27 18:43:07 +02:00 committed by GitHub
parent 0fee2c234e
commit 1297673a70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 18 deletions

View File

@ -152,7 +152,7 @@ def _ensure_bootstrap_configuration() -> Generator:
bootstrap_store_path = store_path()
user_configuration = _read_and_sanitize_configuration()
with spack.environment.no_active_environment():
with spack.platforms.prevent_cray_detection(), spack.platforms.use_platform(
with spack.platforms.use_platform(
spack.platforms.real_host()
), spack.repo.use_repositories(spack.paths.packages_path):
# Default configuration scopes excluding command line

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import contextlib
from ._functions import _host, by_name, platforms, prevent_cray_detection, reset
from ._functions import _host, by_name, platforms, reset
from ._platform import Platform
from .darwin import Darwin
from .freebsd import FreeBSD
@ -23,7 +23,6 @@
"host",
"by_name",
"reset",
"prevent_cray_detection",
]
#: The "real" platform of the host running Spack. This should not be changed

View File

@ -2,12 +2,8 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import contextlib
import llnl.util.lang
import spack.util.environment
from .darwin import Darwin
from .freebsd import FreeBSD
from .linux import Linux
@ -57,14 +53,3 @@ def by_name(name):
"""
platform_cls = cls_by_name(name)
return platform_cls() if platform_cls else None
@contextlib.contextmanager
def prevent_cray_detection():
"""Context manager that prevents the detection of the Cray platform"""
reset()
try:
with spack.util.environment.set_env(MODULEPATH=""):
yield
finally:
reset()