Kaydet (Commit) c1cb0493 authored tarafından Greg Ward's avatar Greg Ward

Moved the CCompiler exceptions here, to avoid having to import ccompiler.py

  just to get a little exception class.
No more string-based exceptions.
üst d151711e
...@@ -12,82 +12,81 @@ symbols whose names start with "Distutils" and end with "Error".""" ...@@ -12,82 +12,81 @@ symbols whose names start with "Distutils" and end with "Error"."""
__revision__ = "$Id$" __revision__ = "$Id$"
import types class DistutilsError (Exception):
"""The root of all Distutils evil."""
if type (RuntimeError) is types.ClassType: pass
class DistutilsError (Exception): class DistutilsModuleError (DistutilsError):
"""The root of all Distutils evil.""" """Unable to load an expected module, or to find an expected class
pass within some module (in particular, command modules and classes)."""
pass
class DistutilsModuleError (DistutilsError):
"""Unable to load an expected module, or to find an expected class class DistutilsClassError (DistutilsError):
within some module (in particular, command modules and classes).""" """Some command class (or possibly distribution class, if anyone
pass feels a need to subclass Distribution) is found not to be holding
up its end of the bargain, ie. implementing some part of the
class DistutilsClassError (DistutilsError): "command "interface."""
"""Some command class (or possibly distribution class, if anyone pass
feels a need to subclass Distribution) is found not to be holding
up its end of the bargain, ie. implementing some part of the class DistutilsGetoptError (DistutilsError):
"command "interface.""" """The option table provided to 'fancy_getopt()' is bogus."""
pass pass
class DistutilsGetoptError (DistutilsError): class DistutilsArgError (DistutilsError):
"""The option table provided to 'fancy_getopt()' is bogus.""" """Raised by fancy_getopt in response to getopt.error -- ie. an
pass error in the command line usage."""
pass
class DistutilsArgError (DistutilsError):
"""Raised by fancy_getopt in response to getopt.error -- ie. an class DistutilsFileError (DistutilsError):
error in the command line usage.""" """Any problems in the filesystem: expected file not found, etc.
pass Typically this is for problems that we detect before IOError or
OSError could be raised."""
class DistutilsFileError (DistutilsError): pass
"""Any problems in the filesystem: expected file not found, etc.
Typically this is for problems that we detect before IOError or class DistutilsOptionError (DistutilsError):
OSError could be raised.""" """Syntactic/semantic errors in command options, such as use of
pass mutually conflicting options, or inconsistent options,
badly-spelled values, etc. No distinction is made between option
class DistutilsOptionError (DistutilsError): values originating in the setup script, the command line, config
"""Syntactic/semantic errors in command options, such as use of files, or what-have-you -- but if we *know* something originated in
mutually conflicting options, or inconsistent options, the setup script, we'll raise DistutilsSetupError instead."""
badly-spelled values, etc. No distinction is made between option pass
values originating in the setup script, the command line, config
files, or what-have-you -- but if we *know* something originated in class DistutilsSetupError (DistutilsError):
the setup script, we'll raise DistutilsSetupError instead.""" """For errors that can be definitely blamed on the setup script,
pass such as invalid keyword arguments to 'setup()'."""
pass
class DistutilsSetupError (DistutilsError):
"""For errors that can be definitely blamed on the setup script, class DistutilsPlatformError (DistutilsError):
such as invalid keyword arguments to 'setup()'.""" """We don't know how to do something on the current platform (but
pass we do know how to do it on some platform) -- eg. trying to compile
C files on a platform not supported by a CCompiler subclass."""
class DistutilsPlatformError (DistutilsError): pass
"""We don't know how to do something on the current platform (but
we do know how to do it on some platform) -- eg. trying to compile class DistutilsExecError (DistutilsError):
C files on a platform not supported by a CCompiler subclass.""" """Any problems executing an external program (such as the C
pass compiler, when compiling C files)."""
pass
class DistutilsExecError (DistutilsError):
"""Any problems executing an external program (such as the C class DistutilsInternalError (DistutilsError):
compiler, when compiling C files).""" """Internal inconsistencies or impossibilities (obviously, this
pass should never be seen if the code is working!)."""
pass
class DistutilsInternalError (DistutilsError):
"""Internal inconsistencies or impossibilities (obviously, this
should never be seen if the code is working!).""" # Exception classes used by the CCompiler implementation classes
pass class CCompilerError (Exception):
"""Some compile/link operation failed."""
# String-based exceptions
else: class CompileError (CCompilerError):
DistutilsError = 'DistutilsError' """Failure to compile one or more C/C++ source files."""
DistutilsModuleError = 'DistutilsModuleError'
DistutilsClassError = 'DistutilsClassError' class LibError (CCompilerError):
DistutilsGetoptError = 'DistutilsGetoptError' """Failure to create a static library from one or more C/C++ object
DistutilsArgError = 'DistutilsArgError' files."""
DistutilsFileError = 'DistutilsFileError'
DistutilsOptionError = 'DistutilsOptionError' class LinkError (CCompilerError):
DistutilsPlatformError = 'DistutilsPlatformError' """Failure to link one or more C/C++ object files into an executable
DistutilsExecError = 'DistutilsExecError' or shared library file."""
DistutilsInternalError = 'DistutilsInternalError'
del types
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment