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 5, 2024
1 parent 01807e1 commit b97f737
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 @@ -8,6 +8,20 @@
This module is safe to use in "from ... import *" mode; it only exports
symbols whose names start with "Distutils" and end with "Error"."""

# 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 @@ -98,30 +112,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 b97f737

Please sign in to comment.