diff --git a/distutils/compilers/C/errors.py b/distutils/compilers/C/errors.py new file mode 100644 index 00000000..01328592 --- /dev/null +++ b/distutils/compilers/C/errors.py @@ -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.""" diff --git a/distutils/errors.py b/distutils/errors.py index 626254c3..64151559 100644 --- a/distutils/errors.py +++ b/distutils/errors.py @@ -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.""" @@ -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."""