spack.package: wrap llnl.util.tty (#48793)

avoid import of llnl.util.tty in packages
This commit is contained in:
Harmen Stoppels 2025-01-31 08:17:29 +01:00 committed by GitHub
parent e1b579a8b4
commit d0cbd056a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
54 changed files with 17 additions and 92 deletions

View File

@ -13,6 +13,17 @@
# import most common types used in packages
from typing import Dict, List, Optional
class tty:
import llnl.util.tty as _tty
debug = _tty.debug
error = _tty.error
info = _tty.info
msg = _tty.msg
warn = _tty.warn
from llnl.util.filesystem import (
FileFilter,
FileList,

View File

@ -5,8 +5,6 @@
import inspect
import os
import llnl.util.tty as tty
import spack.pkg.builtin.openfoam as openfoam
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from llnl.util import tty
from spack.package import *
from spack.pkg.builtin.llvm import LlvmDetection

View File

@ -6,8 +6,6 @@
import os
import socket
import llnl.util.tty as tty
from spack.build_systems.cmake import CMakeBuilder
from spack.package import *

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *
from spack.util.environment import set_env

View File

@ -9,8 +9,6 @@
import sys
from os import environ as env
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import glob
import os
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.boost import Boost

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *
from spack.package_test import compare_output
from spack.pkg.builtin.boost import Boost

View File

@ -8,8 +8,6 @@
import socket
from os import environ as env
import llnl.util.tty as tty
from spack.package import *

View File

@ -7,8 +7,6 @@
import re
from glob import glob
import llnl.util.tty as tty
from spack.package import *
# FIXME Remove hack for polymorphic versions
@ -741,7 +739,7 @@ def install(self, spec, prefix):
os.remove("/tmp/cuda-installer.log")
except OSError:
if spec.satisfies("@10.1:"):
tty.die(
raise InstallError(
"The cuda installer will segfault due to the "
"presence of /tmp/cuda-installer.log "
"please remove the file and try again "

View File

@ -5,8 +5,6 @@
import os
import socket
import llnl.util.tty as tty
from spack.build_systems.cmake import CMakeBuilder
from spack.package import *

View File

@ -41,7 +41,7 @@ def makefile_name(self):
elif self.spec.satisfies("platform=linux target=x86_64:"):
name = "Makefile.linux64_sse2"
else:
tty.die(
raise InstallError(
"""Unsupported platform/target, must be
Darwin (assumes 64-bit)
Linux x86_64

View File

@ -32,8 +32,6 @@
import os
import re
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.openfoam import (
OpenfoamArch,

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import os
import llnl.util.tty as tty
import spack.tengine
from spack.package import *

View File

@ -8,8 +8,6 @@
from macholib import MachO, mach_o
from llnl.util import tty
from spack.package import *
from spack.util.elf import delete_needed_from_elf, parse_elf

View File

@ -7,7 +7,6 @@
import archspec.cpu
import llnl.util.tty as tty
from llnl.util.symlink import readlink
import spack.compiler

View File

@ -8,7 +8,6 @@
import sys
import llnl.util.lang
import llnl.util.tty as tty
from spack.package import *

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *
from spack.util.environment import EnvironmentModifications

View File

@ -6,8 +6,6 @@
import os
import tempfile
import llnl.util.tty as tty
import spack.build_systems.autotools
import spack.build_systems.meson
from spack.package import *

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from llnl.util import tty
from spack.package import *
from spack.pkg.builtin.gcc_runtime import get_elf_libraries

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
import llnl.util.tty as tty
import spack.compiler
from spack.package import *

View File

@ -4,8 +4,6 @@
import subprocess
import llnl.util.tty as tty
from spack.package import *

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import glob
import os
import llnl.util.tty as tty
import spack.tengine
from spack.package import *

View File

@ -7,8 +7,6 @@
import shutil
from textwrap import dedent
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import re
import sys
import llnl.util.tty as tty
from spack.build_systems.cmake import get_cmake_prefix_path
from spack.package import *

View File

@ -5,7 +5,6 @@
import re
import sys
import llnl.util.tty as tty
from llnl.util.lang import classproperty
import spack.compilers

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from llnl.util import tty
from spack.package import *

View File

@ -6,8 +6,6 @@
import platform
import sys
import llnl.util.tty as tty
from spack.build_environment import optimization_flags
from spack.package import *

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *
@ -192,7 +190,7 @@ def configure_args(self):
else:
# To be foolproof, fail with a proper error message
# if neither FFTW nor MKL are in the dependency tree.
tty.die(
raise InstallError(
'Unsupported "fftw-api" provider, '
"currently only FFTW and MKL are supported.\n"
"Please report this issue on Spack's repository."

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.openfoam import add_extra_files

View File

@ -38,8 +38,6 @@
import os
import re
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.openfoam import (
OpenfoamArch,

View File

@ -43,8 +43,6 @@
import os
import re
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.boost import Boost
from spack.util.environment import EnvironmentModifications

View File

@ -7,8 +7,6 @@
import re
import sys
import llnl.util.tty as tty
import spack.compilers
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import os
import re
import llnl.util.tty as tty
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *
@ -43,6 +42,6 @@ def install(self, spec, prefix):
oras = find("bin", "oras")
if not oras:
tty.die("Oras executable missing in bin.")
raise InstallError("Oras executable missing in bin.")
tty.debug("Found oras executable %s to move into install bin" % oras[0])
install(oras[0], prefix.bin)

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
import llnl.util.tty as tty
from spack.package import *

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import llnl.util.tty as tty
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
import spack.hooks.sbang as sbang
from spack.package import *

View File

@ -12,7 +12,6 @@
from shutil import copy
from typing import Dict, List
import llnl.util.tty as tty
from llnl.util.lang import dedupe
import spack.paths

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -8,8 +8,6 @@
import sys
import tempfile
import llnl.util.tty as tty
from spack.operating_systems.mac_os import macos_version
from spack.package import *

View File

@ -6,8 +6,6 @@
import platform
import sys
import llnl.util.tty as tty
from spack.operating_systems.linux_distro import kernel_version
from spack.operating_systems.mac_os import macos_version
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -5,8 +5,6 @@
import os
import shutil
import llnl.util.tty as tty
import spack.tengine
from spack.package import *

View File

@ -4,8 +4,6 @@
import os
import llnl.util.tty as tty
from spack.package import *
from spack.util.environment import set_env

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack.package import *

View File

@ -8,8 +8,6 @@
import sys
from os import environ as env
import llnl.util.tty as tty
from spack.package import *

View File

@ -10,8 +10,6 @@
from pathlib import Path
from subprocess import PIPE, Popen
from llnl.util import tty
from spack.package import *
if sys.platform != "win32":

View File

@ -259,7 +259,7 @@ def setup_build_environment(self, env):
else:
# The user has selected a (new?) legal value that we've
# forgotten to deal with here.
tty.die(
raise InstallError(
"INTERNAL ERROR: cannot accommodate unexpected variant ",
"cxxstd={0}".format(self.spec.variants["cxxstd"].value),
)