mirror of
https://github.com/python/cpython.git
synced 2025-10-23 07:02:24 +00:00
Moved the CCompiler exceptions here, to avoid having to import ccompiler.py
just to get a little exception class. No more string-based exceptions.
This commit is contained in:
parent
d151711e66
commit
c1cb0493f8
1 changed files with 65 additions and 66 deletions
|
@ -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."""
|
||||||
|
pass
|
||||||
|
|
||||||
if type (RuntimeError) is types.ClassType:
|
class DistutilsModuleError (DistutilsError):
|
||||||
|
"""Unable to load an expected module, or to find an expected class
|
||||||
|
within some module (in particular, command modules and classes)."""
|
||||||
|
pass
|
||||||
|
|
||||||
class DistutilsError (Exception):
|
class DistutilsClassError (DistutilsError):
|
||||||
"""The root of all Distutils evil."""
|
"""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
|
||||||
|
"command "interface."""
|
||||||
|
pass
|
||||||
|
|
||||||
class DistutilsModuleError (DistutilsError):
|
class DistutilsGetoptError (DistutilsError):
|
||||||
"""Unable to load an expected module, or to find an expected class
|
"""The option table provided to 'fancy_getopt()' is bogus."""
|
||||||
within some module (in particular, command modules and classes)."""
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsClassError (DistutilsError):
|
class DistutilsArgError (DistutilsError):
|
||||||
"""Some command class (or possibly distribution class, if anyone
|
"""Raised by fancy_getopt in response to getopt.error -- ie. an
|
||||||
feels a need to subclass Distribution) is found not to be holding
|
error in the command line usage."""
|
||||||
up its end of the bargain, ie. implementing some part of the
|
pass
|
||||||
"command "interface."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsGetoptError (DistutilsError):
|
class DistutilsFileError (DistutilsError):
|
||||||
"""The option table provided to 'fancy_getopt()' is bogus."""
|
"""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."""
|
||||||
|
pass
|
||||||
|
|
||||||
class DistutilsArgError (DistutilsError):
|
class DistutilsOptionError (DistutilsError):
|
||||||
"""Raised by fancy_getopt in response to getopt.error -- ie. an
|
"""Syntactic/semantic errors in command options, such as use of
|
||||||
error in the command line usage."""
|
mutually conflicting options, or inconsistent options,
|
||||||
pass
|
badly-spelled values, etc. No distinction is made between option
|
||||||
|
values originating in the setup script, the command line, config
|
||||||
|
files, or what-have-you -- but if we *know* something originated in
|
||||||
|
the setup script, we'll raise DistutilsSetupError instead."""
|
||||||
|
pass
|
||||||
|
|
||||||
class DistutilsFileError (DistutilsError):
|
class DistutilsSetupError (DistutilsError):
|
||||||
"""Any problems in the filesystem: expected file not found, etc.
|
"""For errors that can be definitely blamed on the setup script,
|
||||||
Typically this is for problems that we detect before IOError or
|
such as invalid keyword arguments to 'setup()'."""
|
||||||
OSError could be raised."""
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsOptionError (DistutilsError):
|
class DistutilsPlatformError (DistutilsError):
|
||||||
"""Syntactic/semantic errors in command options, such as use of
|
"""We don't know how to do something on the current platform (but
|
||||||
mutually conflicting options, or inconsistent options,
|
we do know how to do it on some platform) -- eg. trying to compile
|
||||||
badly-spelled values, etc. No distinction is made between option
|
C files on a platform not supported by a CCompiler subclass."""
|
||||||
values originating in the setup script, the command line, config
|
pass
|
||||||
files, or what-have-you -- but if we *know* something originated in
|
|
||||||
the setup script, we'll raise DistutilsSetupError instead."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsSetupError (DistutilsError):
|
class DistutilsExecError (DistutilsError):
|
||||||
"""For errors that can be definitely blamed on the setup script,
|
"""Any problems executing an external program (such as the C
|
||||||
such as invalid keyword arguments to 'setup()'."""
|
compiler, when compiling C files)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class DistutilsPlatformError (DistutilsError):
|
class DistutilsInternalError (DistutilsError):
|
||||||
"""We don't know how to do something on the current platform (but
|
"""Internal inconsistencies or impossibilities (obviously, this
|
||||||
we do know how to do it on some platform) -- eg. trying to compile
|
should never be seen if the code is working!)."""
|
||||||
C files on a platform not supported by a CCompiler subclass."""
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsExecError (DistutilsError):
|
|
||||||
"""Any problems executing an external program (such as the C
|
|
||||||
compiler, when compiling C files)."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
class DistutilsInternalError (DistutilsError):
|
# Exception classes used by the CCompiler implementation classes
|
||||||
"""Internal inconsistencies or impossibilities (obviously, this
|
class CCompilerError (Exception):
|
||||||
should never be seen if the code is working!)."""
|
"""Some compile/link operation failed."""
|
||||||
pass
|
|
||||||
|
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."""
|
||||||
|
|
||||||
|
|
||||||
# String-based exceptions
|
|
||||||
else:
|
|
||||||
DistutilsError = 'DistutilsError'
|
|
||||||
DistutilsModuleError = 'DistutilsModuleError'
|
|
||||||
DistutilsClassError = 'DistutilsClassError'
|
|
||||||
DistutilsGetoptError = 'DistutilsGetoptError'
|
|
||||||
DistutilsArgError = 'DistutilsArgError'
|
|
||||||
DistutilsFileError = 'DistutilsFileError'
|
|
||||||
DistutilsOptionError = 'DistutilsOptionError'
|
|
||||||
DistutilsPlatformError = 'DistutilsPlatformError'
|
|
||||||
DistutilsExecError = 'DistutilsExecError'
|
|
||||||
DistutilsInternalError = 'DistutilsInternalError'
|
|
||||||
|
|
||||||
del types
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue