diff --git a/lib/spack/external/archspec/cpu/__init__.py b/lib/spack/external/archspec/cpu/__init__.py index 6fbb43b785..a21e523c0b 100644 --- a/lib/spack/external/archspec/cpu/__init__.py +++ b/lib/spack/external/archspec/cpu/__init__.py @@ -8,7 +8,6 @@ from .detect import brand_string, host from .microarchitecture import ( TARGETS, - InvalidCompilerVersion, Microarchitecture, UnsupportedMicroarchitecture, generic_microarchitecture, @@ -16,12 +15,11 @@ ) __all__ = [ - "brand_string", - "host", - "TARGETS", - "InvalidCompilerVersion", "Microarchitecture", "UnsupportedMicroarchitecture", + "TARGETS", "generic_microarchitecture", + "host", "version_components", + "brand_string", ] diff --git a/lib/spack/external/archspec/cpu/microarchitecture.py b/lib/spack/external/archspec/cpu/microarchitecture.py index 1ffe51d918..73c1499978 100644 --- a/lib/spack/external/archspec/cpu/microarchitecture.py +++ b/lib/spack/external/archspec/cpu/microarchitecture.py @@ -213,8 +213,6 @@ def optimization_flags(self, compiler, version): """Returns a string containing the optimization flags that needs to be used to produce code optimized for this micro-architecture. - The version is expected to be a string of dot separated digits. - If there is no information on the compiler passed as argument the function returns an empty string. If it is known that the compiler version we want to use does not support this architecture the function @@ -223,11 +221,6 @@ def optimization_flags(self, compiler, version): Args: compiler (str): name of the compiler to be used version (str): version of the compiler to be used - - Raises: - UnsupportedMicroarchitecture: if the requested compiler does not support - this micro-architecture. - ValueError: if the version doesn't match the expected format """ # If we don't have information on compiler at all return an empty string if compiler not in self.family.compilers: @@ -244,14 +237,6 @@ def optimization_flags(self, compiler, version): msg = msg.format(compiler, best_target, best_target.family) raise UnsupportedMicroarchitecture(msg) - # Check that the version matches the expected format - if not re.match(r"^(?:\d+\.)*\d+$", version): - msg = ( - "invalid format for the compiler version argument. " - "Only dot separated digits are allowed." - ) - raise InvalidCompilerVersion(msg) - # If we have information on this compiler we need to check the # version being used compiler_info = self.compilers[compiler] @@ -390,15 +375,7 @@ def fill_target_from_dict(name, data, targets): TARGETS = LazyDictionary(_known_microarchitectures) -class ArchspecError(Exception): - """Base class for errors within archspec""" - - -class UnsupportedMicroarchitecture(ArchspecError, ValueError): +class UnsupportedMicroarchitecture(ValueError): """Raised if a compiler version does not support optimization for a given micro-architecture. """ - - -class InvalidCompilerVersion(ArchspecError, ValueError): - """Raised when an invalid format is used for compiler versions in archspec."""