Move NoLibrariesError/NoHeadersError into error.py (#10997)
Also add constructor to NoLibrariesError which can either take an error message (like other SpackErrors) or a name and prefix (in which case the error message is constructed).
This commit is contained in:
parent
39855fbcf8
commit
95fafb4e44
@ -58,6 +58,7 @@
|
|||||||
env_flag, filter_system_paths, get_path, is_system_path,
|
env_flag, filter_system_paths, get_path, is_system_path,
|
||||||
EnvironmentModifications, validate, preserve_environment)
|
EnvironmentModifications, validate, preserve_environment)
|
||||||
from spack.util.environment import system_dirs
|
from spack.util.environment import system_dirs
|
||||||
|
from spack.error import NoLibrariesError, NoHeadersError
|
||||||
from spack.util.executable import Executable
|
from spack.util.executable import Executable
|
||||||
from spack.util.module_cmd import load_module, get_path_from_module
|
from spack.util.module_cmd import load_module, get_path_from_module
|
||||||
from spack.util.log_parse import parse_log_events, make_log_context
|
from spack.util.log_parse import parse_log_events, make_log_context
|
||||||
@ -280,7 +281,7 @@ def set_build_environment_variables(pkg, env, dirty):
|
|||||||
dep_link_dirs = list()
|
dep_link_dirs = list()
|
||||||
try:
|
try:
|
||||||
dep_link_dirs.extend(query.libs.directories)
|
dep_link_dirs.extend(query.libs.directories)
|
||||||
except spack.spec.NoLibrariesError:
|
except NoLibrariesError:
|
||||||
tty.debug("No libraries found for {0}".format(dep.name))
|
tty.debug("No libraries found for {0}".format(dep.name))
|
||||||
|
|
||||||
for default_lib_dir in ['lib', 'lib64']:
|
for default_lib_dir in ['lib', 'lib64']:
|
||||||
@ -294,7 +295,7 @@ def set_build_environment_variables(pkg, env, dirty):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
include_dirs.extend(query.headers.directories)
|
include_dirs.extend(query.headers.directories)
|
||||||
except spack.spec.NoHeadersError:
|
except NoHeadersError:
|
||||||
tty.debug("No headers found for {0}".format(dep.name))
|
tty.debug("No headers found for {0}".format(dep.name))
|
||||||
|
|
||||||
link_dirs = list(dedupe(filter_system_paths(link_dirs)))
|
link_dirs = list(dedupe(filter_system_paths(link_dirs)))
|
||||||
|
@ -98,6 +98,21 @@ def __init__(self, message):
|
|||||||
super(UnsupportedPlatformError, self).__init__(message)
|
super(UnsupportedPlatformError, self).__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
class NoLibrariesError(SpackError):
|
||||||
|
"""Raised when package libraries are requested but cannot be found"""
|
||||||
|
|
||||||
|
def __init__(self, message_or_name, prefix=None):
|
||||||
|
super(NoLibrariesError, self).__init__(
|
||||||
|
message_or_name if prefix is None else
|
||||||
|
'Unable to locate {0} libraries in {1}'.format(
|
||||||
|
message_or_name, prefix)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NoHeadersError(SpackError):
|
||||||
|
"""Raised when package headers are requested but cannot be found"""
|
||||||
|
|
||||||
|
|
||||||
class SpecError(SpackError):
|
class SpecError(SpackError):
|
||||||
"""Superclass for all errors that occur while constructing specs."""
|
"""Superclass for all errors that occur while constructing specs."""
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@
|
|||||||
|
|
||||||
from spack.dependency import Dependency, all_deptypes, canonical_deptype
|
from spack.dependency import Dependency, all_deptypes, canonical_deptype
|
||||||
from spack.util.module_cmd import get_path_from_module, load_module
|
from spack.util.module_cmd import get_path_from_module, load_module
|
||||||
from spack.error import SpackError, SpecError, UnsatisfiableSpecError
|
from spack.error import NoLibrariesError, NoHeadersError
|
||||||
|
from spack.error import SpecError, UnsatisfiableSpecError
|
||||||
from spack.provider_index import ProviderIndex
|
from spack.provider_index import ProviderIndex
|
||||||
from spack.util.crypto import prefix_bits
|
from spack.util.crypto import prefix_bits
|
||||||
from spack.util.executable import Executable
|
from spack.util.executable import Executable
|
||||||
@ -4019,14 +4020,6 @@ class DuplicateCompilerSpecError(SpecError):
|
|||||||
"""Raised when the same compiler occurs in a spec twice."""
|
"""Raised when the same compiler occurs in a spec twice."""
|
||||||
|
|
||||||
|
|
||||||
class NoLibrariesError(SpackError):
|
|
||||||
"""Raised when package libraries are requested but cannot be found"""
|
|
||||||
|
|
||||||
|
|
||||||
class NoHeadersError(SpackError):
|
|
||||||
"""Raised when package headers are requested but cannot be found"""
|
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedCompilerError(SpecError):
|
class UnsupportedCompilerError(SpecError):
|
||||||
"""Raised when the user asks for a compiler spack doesn't know about."""
|
"""Raised when the user asks for a compiler spack doesn't know about."""
|
||||||
def __init__(self, compiler_name):
|
def __init__(self, compiler_name):
|
||||||
|
Loading…
Reference in New Issue
Block a user