Skip to content

Commit

Permalink
Move compiler execeptions to their package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 6, 2024
1 parent c315307 commit eaaa82f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 27 deletions.
24 changes: 24 additions & 0 deletions distutils/compilers/C/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Error(Exception):
"""Some compile/link operation failed."""


class PreprocessError(Error):
"""Failure to preprocess one or more C/C++ files."""


class CompileError(Error):
"""Failure to compile one or more C/C++ source files."""


class LibError(Error):
"""Failure to create a static library from one or more C/C++ object
files."""


class LinkError(Error):
"""Failure to link one or more C/C++ object files into an executable
or shared library file."""


class UnknownFileType(Error):
"""Attempt to process an unknown file type."""
41 changes: 14 additions & 27 deletions distutils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
including :exc:`SystemExit`.
"""

# compiler exceptions aliased for compatibility
from .compilers.C.errors import (
CompileError, # noqa: F401
LibError, # noqa: F401
LinkError, # noqa: F401
PreprocessError, # noqa: F401
)
from .compilers.C.errors import (
Error as CCompilerError, # noqa: F401
)
from .compilers.C.errors import (
UnknownFileType as UnknownFileError, # noqa: F401
)


class DistutilsError(Exception):
"""The root of all Distutils evil."""
Expand Down Expand Up @@ -95,30 +109,3 @@ class DistutilsTemplateError(DistutilsError):

class DistutilsByteCompileError(DistutilsError):
"""Byte compile error."""


# Exception classes used by the CCompiler implementation classes
class CCompilerError(Exception):
"""Some compile/link operation failed."""


class PreprocessError(CCompilerError):
"""Failure to preprocess one or more C/C++ files."""


class CompileError(CCompilerError):
"""Failure to compile one or more C/C++ source files."""


class LibError(CCompilerError):
"""Failure to create a static library from one or more C/C++ object
files."""


class LinkError(CCompilerError):
"""Failure to link one or more C/C++ object files into an executable
or shared library file."""


class UnknownFileError(CCompilerError):
"""Attempt to process an unknown file type."""

0 comments on commit eaaa82f

Please sign in to comment.